From 1df52f93b968e70b429404e09582c2804b0bff8d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 7 Nov 2014 08:31:49 -0800 Subject: [PATCH] Get rid of dump_substs(). --- dump.c | 74 ++++++++++++++++++++++------------------------------------ 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/dump.c b/dump.c index a7bd6c2c14..93d9949121 100644 --- a/dump.c +++ b/dump.c @@ -204,20 +204,8 @@ dump_value_31(void) match_byte_assert (0x58); } -static void dump_substs(void (*dump)(int level), int level); static void dump_value__(int level, bool match1); -static void -dump_value__with_preskip(int level) -{ - match_byte(0); - match_byte(0); - match_byte(0); - match_byte(0); - dump_value__ (level, false); - putchar('\n'); -} - static void dump_value__(int level, bool match1) { @@ -291,7 +279,33 @@ dump_value__(int level, bool match1) match_byte (1); } else - dump_substs(dump_value__with_preskip, level + 1); + { + dump_value_31(); + + char *base = get_string(); + int x = get_u32(); + printf ("\"%s\" with %d variables:\n", base, x); + for (int i = 0; i < x; i++) + { + int y = get_u32(); + if (!y) + y = 1; + else + match_u32_assert(0); + for (int j = 0; j <= level; j++) + printf (" "); + 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'); + } + } + } } static void @@ -368,32 +382,6 @@ dump_dims(void) } } -static void -dump_substs(void (*dump)(int level), int level) -{ - dump_value_31(); - - char *base = get_string(); - int x = get_u32(); - printf ("\"%s\" with %d variables:\n", base, x); - for (int i = 0; i < x; i++) - { - int y = get_u32(); - if (!y) - y = 1; - else - match_u32_assert(0); - for (int j = 0; j <= level; j++) - printf (" "); - printf("variable %d has %d values:\n", i, y); - for (int j = 0; j < y; j++) - { - dump (level+1); - putchar('\n'); - } - } -} - static void dump_data_value(int level) { @@ -404,10 +392,7 @@ dump_data_value(int level) match_byte(0); match_byte(0); match_byte(0); - if (data[pos] <= 5) - dump_value__(0, false); - else - dump_substs (dump_data_value, level + 1); + dump_value__(0, false); } static void @@ -448,10 +433,7 @@ dump_title_value(int level) match_byte (0); match_byte (0); match_byte (0); - if (data[pos] <= 5) dump_value__(level, true); - else - dump_substs(dump_title_value, level + 1); } static void -- 2.30.2