From d3dfe83aa1633b3895fb1cb761f11b0de39e233e Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 24 Feb 2026 09:04:25 +0900 Subject: [PATCH] apibreak.c: simplify get_break_index() Return directly from the loop instead of using a hit flag and separate index variable. Co-authored-by: Claude --- mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c index 0a151e755..942b9c4cd 100644 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c @@ -65,22 +65,11 @@ static int32_t get_break_index(mrb_debug_context *dbg, uint32_t bpno) { uint32_t i; - int32_t index; - char hit = FALSE; for (i = 0; i < dbg->bpnum; i++) { - if (dbg->bp[i].bpno == bpno) { - hit = TRUE; - index = i; - break; - } + if (dbg->bp[i].bpno == bpno) return i; } - - if (hit == FALSE) { - return MRB_DEBUG_BREAK_INVALID_NO; - } - - return index; + return MRB_DEBUG_BREAK_INVALID_NO; } static int32_t