Remove a meaningless branch condition in `mruby-struct`
The following branch condition is always true:
// mrbgems/mruby-struct/src/struct.c:187 in make_struct_define_accessors()
if (is_local_id(mrb, name) || is_const_id(mrb, name)) {
@@ -158,20 +158,6 @@ mrb_struct_set_m(mrb_state *mrb, mrb_value obj)
return val;
}
-static mrb_bool
-is_local_id(mrb_state *mrb, const char *name)
-{
- if (!name) return FALSE;
- return !ISUPPER(name[0]);
-}
-
-static mrb_bool
-is_const_id(mrb_state *mrb, const char *name)
-{
- if (!name) return FALSE;
- return ISUPPER(name[0]);
-}
-
static void
make_struct_define_accessors(mrb_state *mrb, mrb_value members, struct RClass *c)
{
@@ -182,9 +168,6 @@ make_struct_define_accessors(mrb_state *mrb, mrb_value members, struct RClass *c
for (i=0; i<len; i++) {
mrb_sym id = mrb_symbol(ptr_members[i]);
- const char *name = mrb_sym2name_len(mrb, id, NULL);
-
- if (is_local_id(mrb, name) || is_const_id(mrb, name)) {
mrb_method_t m;
mrb_value at = mrb_fixnum_value(i);
struct RProc *aref = mrb_proc_new_cfunc_with_env(mrb, mrb_struct_ref, 1, &at);
@@ -196,7 +179,6 @@ make_struct_define_accessors(mrb_state *mrb, mrb_value members, struct RClass *c
mrb_gc_arena_restore(mrb, ai);
}
}
-}
static mrb_value
make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass *klass)
