Commit 9d3a864a authored by mattn's avatar mattn

Skip end of loop in mrb_sym2name_len

parent 5a153851
...@@ -81,16 +81,15 @@ mrb_sym2name_len(mrb_state *mrb, mrb_sym sym, int *lenp) ...@@ -81,16 +81,15 @@ mrb_sym2name_len(mrb_state *mrb, mrb_sym sym, int *lenp)
for (k = kh_begin(h); k != kh_end(h); k++) { for (k = kh_begin(h); k != kh_end(h); k++) {
if (kh_exist(h, k)) { if (kh_exist(h, k)) {
if (kh_value(h, k) == sym) break; if (kh_value(h, k) == sym) {
sname = kh_key(h, k);
*lenp = sname.len;
return sname.name;
}
} }
} }
if (k == kh_end(h)) {
*lenp = 0; *lenp = 0;
return NULL; /* missing */ return NULL; /* missing */
}
sname = kh_key(h, k);
*lenp = sname.len;
return sname.name;
} }
void void
......
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