space.c: Strip `typedef' from `buf'; now it's just a struct.
[misc] / space.c
diff --git a/space.c b/space.c
index ef9485f..73fb3a7 100644 (file)
--- a/space.c
+++ b/space.c
@@ -95,16 +95,16 @@ fail_0:
   return (0);
 }
 
-typedef struct buf {
+struct buf {
   char *b;
   size_t n;
   size_t sz;
-} buf;
+};
 #define BUF_INIT { 0, 0, 0 }
 
-static void reset(buf *b) { b->n = 0; }
+static void reset(struct buf *b) { b->n = 0; }
 
-static int put(buf *b, int ch)
+static int put(struct buf *b, int ch)
 {
   size_t w;
 
@@ -130,7 +130,7 @@ static int put(buf *b, int ch)
 
 static int space(const char *name)
 {
-  static buf b = BUF_INIT;
+  static struct buf b = BUF_INIT;
   FILE *fin, *fout = stdout;
   char *newname = 0, *oldname = 0;
   int rc = TROUBLE, status = OK;
@@ -183,17 +183,17 @@ static int space(const char *name)
        break;
       case '\t':
        if (flags & F_UNTABIFY) {
-         if ((flags & F_CHECK) && !(f & f_warntabs)) {
+         if ((flags & F_VERBOSE) && !(f & f_warntabs)) {
            fprintf(stderr, "%s:%u: found tab\n", name, nl);
            f |= f_warntabs;
-           status = BADNESS;
          }
+         status = BADNESS;
        } else if (((flags & F_MIDLINETABS) || (f & f_newline)) && nsp) {
          if ((flags & F_VERBOSE) && !(f & f_warnspacetab)) {
            fprintf(stderr, "%s:%u: space followed by tab\n", name, nl);
            f |= f_warnspacetab;
-           status = BADNESS;
          }
+         status = BADNESS;
          f |= f_tabify | f_forced;
        }
        f |= f_tab;
@@ -210,8 +210,9 @@ static int space(const char *name)
        goto end;
       case '\n':
       case '\v':
-       if (nwsp && (flags & F_VERBOSE)) {
-         fprintf(stderr, "%s:%u: trailing whitespace\n", name, nl);
+       if (nwsp) {
+         if (flags & F_VERBOSE)
+           fprintf(stderr, "%s:%u: trailing whitespace\n", name, nl);
          status = BADNESS;
        }
        if (fout) putc('\n', fout);