From 18baf335922219e337202001c3875e72fc5545e2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 6 Nov 2014 23:06:59 -0800 Subject: [PATCH] make all the dump_*_() functions much more similar --- dump.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/dump.c b/dump.c index 854486fde4..bf6003e9b1 100644 --- a/dump.c +++ b/dump.c @@ -314,10 +314,11 @@ dump_dim_value(int level) for (int i = 0; i <= level; i++) printf (" "); - if (data[pos] == 3 || data[pos] == 5) - dump_value__(level, true); - else - dump_value(level, true); + match_byte(0); + match_byte(0); + match_byte(0); + match_byte(0); + dump_value__(level, true); } static void @@ -363,15 +364,9 @@ dump_dim(void) match_u32_assert(2); if (!match_byte(0)) match_byte_assert(1); - match_byte(0); - match_byte(0); - match_byte(0); - match_byte(0); get_u32(); match_byte(0); match_byte(0); - match_byte(0); - match_byte(0); n_categories = get_u32(); printf("%d nested categories\n", n_categories); for (int i = 0; i < n_categories; i++) @@ -427,10 +422,8 @@ dump_data_value(int level) match_byte(0); match_byte(0); match_byte(0); - if (data[pos] == 1 || data[pos] == 2 || data[pos] == 3 || data[pos] == 4) + if (data[pos] <= 5) dump_value__(0, false); - else if (data[pos] == 5) - dump_value (0, true); else dump_substs (dump_data_value, level + 1); } @@ -473,9 +466,7 @@ dump_title_value(int level) match_byte (0); match_byte (0); match_byte (0); - if (data[pos] == 1 || data[pos] == 2 || data[pos] == 3 || data[pos] == 4) - dump_value(level, true); - else if (data[pos] == 5) + if (data[pos] <= 5) dump_value__(level, true); else dump_substs(dump_title_value, level + 1); @@ -491,9 +482,7 @@ dump_footnote_value(int level) match_byte (0); match_byte (0); match_byte (0); - if (data[pos] == 2 || data[pos] == 4) - dump_value(level, true); - else if (data[pos] == 1 || data[pos] == 3 || data[pos] == 5) + if (data[pos] <= 5) dump_value__(level, false); else dump_substs(dump_footnote_value, level + 1); @@ -727,8 +716,7 @@ main(int argc, char *argv[]) dump_dims (); printf("\n\ndata:\n"); dump_data (); - if (pos == n - 1) - match_byte_assert (1); + match_byte (1); if (pos != n) { fprintf (stderr, "%x / %x\n", pos, n); -- 2.30.2