Improve storage class handling:
[cparser] / main.c
diff --git a/main.c b/main.c
index 80817de..b9b62e1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -239,19 +239,20 @@ static void add_flag(struct obstack *obst, const char *format, ...)
 {
        char buf[4096];
        va_list ap;
+
        va_start(ap, format);
+#ifdef _WIN32
+       int len =
+#endif
+               vsnprintf(buf, sizeof(buf), format, ap);
+       va_end(ap);
 
        obstack_1grow(obst, ' ');
 #ifdef _WIN32
        obstack_1grow(obst, '"');
-       int len = vsnprintf(buf, sizeof(buf), format, ap);
        obstack_grow(obst, buf, len);
        obstack_1grow(obst, '"');
 #else
-       char buf[4096];
-       vsnprintf(buf, sizeof(buf), format, ap);
-       va_end(ap);
-
        /* escape stuff... */
        for (char *c = buf; *c != '\0'; ++c) {
                switch(*c) {
@@ -274,7 +275,6 @@ static void add_flag(struct obstack *obst, const char *format, ...)
                }
        }
 #endif
-       va_end(ap);
 }
 
 static const char *type_to_string(type_t *type)