Commit 83c5274a authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #949 from mattn/find_symbol

Skip end of loop in mrb_sym2name_len
parents f962068d 9d3a864a
......@@ -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++) {
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;
return NULL; /* missing */
}
sname = kh_key(h, k);
*lenp = sname.len;
return sname.name;
*lenp = 0;
return NULL; /* missing */
}
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