]> git.saurik.com Git - bison.git/blobdiff - src/system.h
obstacks: simplifications
[bison.git] / src / system.h
index 1d0af8fabddb6e7b5c10678dc1288de5c9abd369..eba7845ee906c5418534fef1d28219c4d1187a68 100644 (file)
@@ -173,38 +173,11 @@ typedef size_t uintptr_t;
 #define obstack_chunk_free  free
 #include <obstack.h>
 
+/* String-grow: append Str to Obs.  */
+
 #define obstack_sgrow(Obs, Str) \
   obstack_grow (Obs, Str, strlen (Str))
 
-#define obstack_fgrow1(Obs, Format, Arg1)       \
-  do {                                          \
-    char buf[4096];                             \
-    sprintf (buf, Format, Arg1);                \
-    obstack_grow (Obs, buf, strlen (buf));      \
-  } while (0)
-
-#define obstack_fgrow2(Obs, Format, Arg1, Arg2) \
-  do {                                          \
-    char buf[4096];                             \
-    sprintf (buf, Format, Arg1, Arg2);          \
-    obstack_grow (Obs, buf, strlen (buf));      \
-  } while (0)
-
-#define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3)   \
-  do {                                                  \
-    char buf[4096];                                     \
-    sprintf (buf, Format, Arg1, Arg2, Arg3);            \
-    obstack_grow (Obs, buf, strlen (buf));              \
-  } while (0)
-
-#define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4)     \
-  do {                                                          \
-    char buf[4096];                                             \
-    sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4);              \
-    obstack_grow (Obs, buf, strlen (buf));                      \
-  } while (0)
-
-
 /* Output Str escaped for our postprocessing (i.e., escape M4 special
    characters).
 
@@ -246,6 +219,11 @@ typedef size_t uintptr_t;
   } while (0)
 
 
+/* Append the ending 0, finish Obs, and return the string.  */
+
+# define obstack_finish0(Obs)                           \
+  (obstack_1grow (Obs, '\0'), (char *) obstack_finish (Obs))
+