Skip to content
Permalink
Browse files
mrb_str_len_to_inum(): fixed a bug with separating _ in the digits; ref
  • Loading branch information
matz committed Dec 14, 2015
1 parent 4a6a114 commit 19c744e14d63996dd5e64db3f8a4440099079ac3
Showing 1 changed file with 9 additions and 3 deletions.
@@ -2125,15 +2125,21 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, size_t len, int base, int b
break;
} /* end of switch (base) { */
if (*p == '0') { /* squeeze preceding 0s */
while (p<pend && ((c = *++p) == '0' || c == '_')) {
p++;
while (p<pend) {
c = *p++;
if (c == '_') {
if (*p == '_') {
if (p<pend && *p == '_') {
if (badcheck) goto bad;
break;
}
continue;
}
if (c != '0') {
p--;
break;
}
}
if (!(c = *p) || ISSPACE(c)) --p;
}
c = *p;
if (badcheck && c == '\0') {

0 comments on commit 19c744e

Please sign in to comment.