From: Explorer09 Date: Fri, 22 Sep 2017 09:27:02 +0000 (+0800) Subject: scanner: Simplify PRINT_SPACES() macro X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37a6184dabcd82fa1d17c24c000f3da469296195;p=flex scanner: Simplify PRINT_SPACES() macro --- diff --git a/src/scanopt.c b/src/scanopt.c index 7745c11..0b6d7d1 100644 --- a/src/scanopt.c +++ b/src/scanopt.c @@ -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.