From 16ed4672661f747d0483c67ca19c8ea15c084922 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 25 Nov 2022 16:16:31 +0900 Subject: [PATCH] mruby-struct: avoid using mrb_bug(); ref #5852 Use mrb_assert() instead. --- mrbgems/mruby-struct/src/struct.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index 7a8701e4c..159705fda 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -526,9 +526,7 @@ mrb_struct_equal(mrb_state *mrb, mrb_value s) if (mrb_obj_class(mrb, s) != mrb_obj_class(mrb, s2)) { return mrb_false_value(); } - if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) { - mrb_bug(mrb, "inconsistent struct"); /* should never happen */ - } + mrb_assert(RSTRUCT_LEN(s) == RSTRUCT_LEN(s2)); ptr = RSTRUCT_PTR(s); ptr2 = RSTRUCT_PTR(s2); len = RSTRUCT_LEN(s); @@ -562,9 +560,7 @@ mrb_struct_eql(mrb_state *mrb, mrb_value s) if (mrb_obj_class(mrb, s) != mrb_obj_class(mrb, s2)) { return mrb_false_value(); } - if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) { - mrb_bug(mrb, "inconsistent struct"); /* should never happen */ - } + mrb_assert(RSTRUCT_LEN(s) == RSTRUCT_LEN(s2)); ptr = RSTRUCT_PTR(s); ptr2 = RSTRUCT_PTR(s2); len = RSTRUCT_LEN(s);