]> granicus.if.org Git - flex/commitdiff
scanner: Simplify PRINT_SPACES() macro
authorExplorer09 <explorer09@gmail.com>
Fri, 22 Sep 2017 09:27:02 +0000 (17:27 +0800)
committerWill Estes <westes575@gmail.com>
Thu, 5 Oct 2017 15:27:54 +0000 (11:27 -0400)
src/scanopt.c

index 7745c11938c5f39febabfe20bcd45a8c350ddd79..0b6d7d16defec8146c2a2f73420331e18347340f 100644 (file)
@@ -366,14 +366,8 @@ int     scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
        }
        desccol = maxlen[0] + indent * 2;
 
-#define PRINT_SPACES(fp,n)\
-    do{\
-        int _n;\
-        _n=(n);\
-        while(_n-- > 0)\
-            fputc(' ',(fp));\
-    }while(0)
-
+#define PRINT_SPACES(fp,n) \
+       fprintf((fp), "%*s", (n), "")
 
        /* Second pass (same as above loop), this time we print. */
        /* Sloppy hack: We iterate twice. The first time we print short and long options.