summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-08-29 12:37:07 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-08-29 12:37:07 +0900
commit6aa091e5aadafa11d9f10d9fa7d821cf5e5e379d (patch)
treed0619b0d3db56f7feceff8fabd11b57afc513a28 /src
parentbc88fc6ed15b9837659071817d93885e4910cba5 (diff)
downloadmruby-6aa091e5aadafa11d9f10d9fa7d821cf5e5e379d.tar.gz
mruby-6aa091e5aadafa11d9f10d9fa7d821cf5e5e379d.zip
Simplified `#ifdef` nesting in `codedump.c`; fix #4089
`printf()` and related functions should not be called when `MRB_DISABLE_STDIO` is defined.
Diffstat (limited to 'src')
-rw-r--r--src/codedump.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/codedump.c b/src/codedump.c
index 80802778f..454b16b36 100644
--- a/src/codedump.c
+++ b/src/codedump.c
@@ -45,7 +45,6 @@ print_lv_ab(mrb_state *mrb, mrb_irep *irep, uint16_t a, uint16_t b)
if (b > 0) print_r(mrb, irep, b);
printf("\n");
}
-#endif
static void
print_header(mrb_irep *irep, ptrdiff_t i)
@@ -68,7 +67,6 @@ print_header(mrb_irep *irep, ptrdiff_t i)
static void
codedump(mrb_state *mrb, mrb_irep *irep)
{
-#ifndef MRB_DISABLE_STDIO
int ai;
mrb_code *pc, *pcend;
mrb_code ins;
@@ -526,7 +524,6 @@ codedump(mrb_state *mrb, mrb_irep *irep)
mrb_gc_arena_restore(mrb, ai);
}
printf("\n");
-#endif
}
static void
@@ -539,9 +536,12 @@ codedump_recur(mrb_state *mrb, mrb_irep *irep)
codedump_recur(mrb, irep->reps[i]);
}
}
+#endif
void
mrb_codedump_all(mrb_state *mrb, struct RProc *proc)
{
+#ifndef MRB_DISABLE_STDIO
codedump_recur(mrb, proc->body.irep);
+#endif
}