Generalize more special cases in dump_title_value().
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 03:12:46 +0000 (19:12 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 03:12:46 +0000 (19:12 -0800)
dump.c

diff --git a/dump.c b/dump.c
index e6d2369a80a112f9ef5aaa57277ff4b724d1bdcf..cb80dd9295795d0feb1eb10ab2ad591a16fbd0bd 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1007,6 +1007,53 @@ dump_data(void)
     }
 }
 
+static void
+dump_title_value_31(int level)
+{
+  if (match_byte (0x31))
+    {
+      if (match_u32 (1))
+        {
+          printf("(footnote %d) ", get_u32());
+          match_byte_assert (0);
+          match_byte_assert (0);
+          int subn = get_u32 ();
+          printf ("nested %d bytes", subn);
+          pos += subn;
+        }
+      else if (match_u32 (2))
+        {
+          printf("(special 2)");
+          match_byte_assert(0);
+          match_byte_assert(0);
+          if (!match_u32(2))
+            match_u32_assert(1);
+          match_byte_assert(0);
+          match_byte_assert(0);
+          int subn = get_u32 ();
+          printf ("nested %d bytes", subn);
+          pos += subn;
+        }
+      else
+        {
+          match_u32_assert(3);
+          printf("(special 3)");
+          match_byte_assert(0);
+          match_byte_assert(0);
+          match_byte_assert(1);
+          match_byte_assert(0);
+          int subn = get_u32 ();
+          printf ("nested %d bytes, ", subn);
+          pos += subn;
+          subn = get_u32 ();
+          printf ("nested %d bytes, ", subn);
+          pos += subn;
+        }
+    }
+  else
+    match_byte_assert (0x58);
+}
+
 static void
 dump_title_value(int level)
 {
@@ -1021,48 +1068,7 @@ dump_title_value(int level)
   if (match_byte (3))
     {
       get_string();
-      if (match_byte (0x31))
-        {
-          if (match_u32 (1))
-            {
-              printf("(footnote %d) ", get_u32());
-              match_byte_assert (0);
-              match_byte_assert (0);
-              int subn = get_u32 ();
-              printf ("nested %d bytes", subn);
-              pos += subn;
-            }
-          else if (match_u32 (2))
-            {
-              printf("(special 2)");
-              match_byte_assert(0);
-              match_byte_assert(0);
-              if (!match_u32(2))
-                match_u32_assert(1);
-              match_byte_assert(0);
-              match_byte_assert(0);
-              int subn = get_u32 ();
-              printf ("nested %d bytes", subn);
-              pos += subn;
-            }
-          else
-            {
-              match_u32_assert(3);
-              printf("(special 3)");
-              match_byte_assert(0);
-              match_byte_assert(0);
-              match_byte_assert(1);
-              match_byte_assert(0);
-              int subn = get_u32 ();
-              printf ("nested %d bytes, ", subn);
-              pos += subn;
-              subn = get_u32 ();
-              printf ("nested %d bytes, ", subn);
-              pos += subn;
-            }
-        }
-      else
-        match_byte_assert (0x58);
+      dump_title_value_31(level);
       get_string();
       printf("string \"%s\"", get_string());
       match_byte (0);
@@ -1077,20 +1083,7 @@ dump_title_value(int level)
     }
   else if (match_byte (5))
     {
-      if (match_byte (0x31))
-        {
-          if (match_u32 (1))
-            {
-              printf("(footnote %d) ", get_u32());
-              match_byte_assert (0);
-              match_byte_assert (0);
-              int subn = get_u32 ();
-              printf ("nested %d bytes", subn);
-              pos += subn;
-            }
-        }
-      else
-        match_byte_assert (0x58);
+      dump_title_value_31(level);
       printf ("variable \"%s\"", get_string());
       get_string();
       if (!match_byte(1) && !match_byte(2))