Commit ac131c90 authored by Jun Hiroe's avatar Jun Hiroe

Remove eql_p variable in mrb_struct_eql func

parent 7dff6ab7
...@@ -659,34 +659,28 @@ mrb_struct_eql(mrb_state *mrb, mrb_value s) ...@@ -659,34 +659,28 @@ mrb_struct_eql(mrb_state *mrb, mrb_value s)
mrb_value s2; mrb_value s2;
mrb_value *ptr, *ptr2; mrb_value *ptr, *ptr2;
mrb_int i, len; mrb_int i, len;
mrb_bool eql_p;
mrb_get_args(mrb, "o", &s2); mrb_get_args(mrb, "o", &s2);
if (mrb_obj_equal(mrb, s, s2)) { if (mrb_obj_equal(mrb, s, s2)) {
eql_p = 1; return mrb_true_value();
} }
else if (strcmp(mrb_class_name(mrb, mrb_obj_class(mrb, s2)), "Struct") || if (strcmp(mrb_class_name(mrb, mrb_obj_class(mrb, s2)), "Struct") ||
mrb_obj_class(mrb, s) != mrb_obj_class(mrb, s2)) { mrb_obj_class(mrb, s) != mrb_obj_class(mrb, s2)) {
eql_p = 0; return mrb_false_value();
} }
else if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) { if (RSTRUCT_LEN(s) != RSTRUCT_LEN(s2)) {
mrb_bug(mrb, "inconsistent struct"); /* should never happen */ mrb_bug(mrb, "inconsistent struct"); /* should never happen */
eql_p = 0; /* This substuture is just to suppress warnings. never called. */
} }
else {
ptr = RSTRUCT_PTR(s); ptr = RSTRUCT_PTR(s);
ptr2 = RSTRUCT_PTR(s2); ptr2 = RSTRUCT_PTR(s2);
len = RSTRUCT_LEN(s); len = RSTRUCT_LEN(s);
eql_p = 1;
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
if (!mrb_eql(mrb, ptr[i], ptr2[i])) { if (!mrb_eql(mrb, ptr[i], ptr2[i])) {
eql_p = 0; return mrb_false_value();
break;
}
} }
} }
return mrb_bool_value(eql_p); return mrb_true_value();
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment