Get rid of dump_value__() wrappers.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 16:35:10 +0000 (08:35 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 16:35:10 +0000 (08:35 -0800)
dump.c

diff --git a/dump.c b/dump.c
index 93d99491211b23d07772486dc742235f58f3af60..ee9794a5012fa4150bd406887827b250bbc18879 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -204,14 +204,17 @@ dump_value_31(void)
     match_byte_assert (0x58);
 }
 
-static void dump_value__(int level, bool match1);
-
 static void
 dump_value__(int level, bool match1)
 {
   for (int i = 0; i <= level; i++)
     printf ("    ");
 
+  match_byte(0);
+  match_byte(0);
+  match_byte(0);
+  match_byte(0);
+
   if (match_byte (3))
     {
       char *s1 = get_string();
@@ -297,10 +300,6 @@ dump_value__(int level, bool match1)
           printf("variable %d has %d values:\n", i, y);
           for (int j = 0; j < y; j++)
             {
-              match_byte(0);
-              match_byte(0);
-              match_byte(0);
-              match_byte(0);
               dump_value__ (level + 1, false);
               putchar('\n');
             }
@@ -311,10 +310,6 @@ dump_value__(int level, bool match1)
 static void
 dump_category(int level)
 {
-  match_byte (0);
-  match_byte (0);
-  match_byte (0);
-  match_byte (0);
   dump_value__ (level, true);
   match_byte(0);
   match_byte(0);
@@ -342,14 +337,12 @@ dump_category(int level)
     dump_category (level + 1);
 }
 
-static void dump_title_value(int level);
-
 static void
 dump_dim(void)
 {
   int n_categories;
   printf("next dim\n");
-  dump_title_value(0);
+  dump_value__ (0, false);
 
   /* This byte is usually 0x02 but 0x00 and 0x75 (!) have also been spotted. */
   pos++;
@@ -382,19 +375,6 @@ dump_dims(void)
     }
 }
 
-static void
-dump_data_value(int level)
-{
-  for (int i = 0; i <= level; i++)
-    printf ("    ");
-
-  match_byte(0);
-  match_byte(0);
-  match_byte(0);
-  match_byte(0);
-  dump_value__(0, false);
-}
-
 static void
 dump_data(void)
 {
@@ -418,37 +398,24 @@ dump_data(void)
     {
       printf("%08x, index %d:\n", pos, get_u32());
       match_u32_assert(0);
-      dump_data_value(0);
+      dump_value__(0, false);
       putchar('\n');
     }
 }
 
-static void
-dump_title_value(int level)
-{
-  for (int i = 0; i <= level; i++)
-    printf ("    ");
-
-  match_byte (0);
-  match_byte (0);
-  match_byte (0);
-  match_byte (0);
-    dump_value__(level, true);
-}
-
 static void
 dump_title(void)
 {
   pos = 0x27;
-  dump_title_value(0); putchar('\n');
-  dump_title_value(0); putchar('\n');
+  dump_value__(0, true); putchar('\n');
+  dump_value__(0, true); putchar('\n');
   match_byte_assert(0x31);
-  dump_title_value(0); putchar('\n');
+  dump_value__(0, true); putchar('\n');
   match_byte(0);
   match_byte_assert(0x58);
   if (match_byte(0x31))
     {
-      dump_data_value(0); putchar('\n');
+      dump_value__(0, false); putchar('\n');
     }
   else
     match_byte_assert(0x58);
@@ -467,7 +434,7 @@ dump_title(void)
       for (int i = 0; i < n_footnotes; i++)
         {
           printf("footnote %d:\n", i);
-          dump_data_value(0);
+          dump_value__(0, false);
           if (match_byte (0x31))
             {
               /* Custom footnote marker string. */