debug.c (mrb_debug_get_position): do not keep lp and fp uninitialized

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-04-06 15:47:24 +09:00
parent ce86040a0f
commit 31c99eb99b
+2 -5
View File
@@ -159,11 +159,7 @@ mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc)
MRB_API mrb_bool
mrb_debug_get_position(mrb_state *mrb, const mrb_irep *irep, uint32_t pc, int32_t *lp, const char **fp)
{
if (irep && pc < irep->ilen) {
if (!irep->debug_info) {
*lp = -1; *fp = NULL;
return FALSE;
}
if (irep && pc < irep->ilen && irep->debug_info) {
mrb_irep_debug_info_file *f = get_file(irep->debug_info, pc);
*lp = debug_get_line(mrb, f, pc);
if (*lp > 0) {
@@ -171,6 +167,7 @@ mrb_debug_get_position(mrb_state *mrb, const mrb_irep *irep, uint32_t pc, int32_
if (*fp) return TRUE;
}
}
*lp = -1; *fp = NULL;
return FALSE;
}