Improve storage class handling:
[cparser] / main.c
diff --git a/main.c b/main.c
index ce9526b..b9b62e1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -231,24 +231,28 @@ static void lextest(FILE *in, const char *fname)
        do {
                lexer_next_preprocessing_token();
                print_token(stdout, &lexer_token);
-               puts("");
+               putchar('\n');
        } while (lexer_token.type != T_EOF);
 }
 
 static void add_flag(struct obstack *obst, const char *format, ...)
 {
-       obstack_1grow(obst, ' ');
-#ifdef _WIN32
-       obstack_1grow(obst, '"');
-       obstack_vprintf(obst, format, ap);
-       obstack_1grow(obst, '"');
-#else
        char buf[4096];
        va_list ap;
+
        va_start(ap, format);
-       vsnprintf(buf, sizeof(buf), format, ap);
+#ifdef _WIN32
+       int len =
+#endif
+               vsnprintf(buf, sizeof(buf), format, ap);
        va_end(ap);
 
+       obstack_1grow(obst, ' ');
+#ifdef _WIN32
+       obstack_1grow(obst, '"');
+       obstack_grow(obst, buf, len);
+       obstack_1grow(obst, '"');
+#else
        /* escape stuff... */
        for (char *c = buf; *c != '\0'; ++c) {
                switch(*c) {