Skip to content

Commit

Permalink
codedump.c: move variable declarations to initialization place
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 30, 2024
1 parent fa213a2 commit 2c8cde2
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/codedump.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ print_args(uint16_t i, FILE *out)
static void
codedump(mrb_state *mrb, const mrb_irep *irep, FILE *out)
{
int ai;
const mrb_code *pc, *pcend;
mrb_code ins;
const char *file = NULL, *next_file;
const char *file = NULL;

if (!irep) return;
fprintf(out, "irep %p nregs=%d nlocals=%d pools=%d syms=%d reps=%d ilen=%d\n", (void*)irep,
Expand Down Expand Up @@ -140,18 +137,18 @@ codedump(mrb_state *mrb, const mrb_irep *irep, FILE *out)
}
}

pc = irep->iseq;
pcend = pc + irep->ilen;
const mrb_code *pc = irep->iseq;
const mrb_code *pcend = pc + irep->ilen;
while (pc < pcend) {
ptrdiff_t i;
uint32_t a;
uint16_t b;
uint16_t c;
mrb_code ins;

ai = mrb_gc_arena_save(mrb);
int ai = mrb_gc_arena_save(mrb);
ptrdiff_t i = pc - irep->iseq;

i = pc - irep->iseq;
next_file = mrb_debug_get_filename(mrb, irep, (uint32_t)i);
const char *next_file = mrb_debug_get_filename(mrb, irep, (uint32_t)i);
if (next_file && file != next_file) {
fprintf(out, "file: %s\n", next_file);
file = next_file;
Expand Down

0 comments on commit 2c8cde2

Please sign in to comment.