readint.c (mrb_read_int): narrow scope of a local variable

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-03-12 08:21:27 +09:00
parent db8368fa86
commit 168eb8c267
+1 -2
View File
@@ -12,10 +12,9 @@ MRB_API mrb_bool
mrb_read_int(const char *p, const char *e, char **endp, mrb_int *np)
{
mrb_int n = 0;
int ch;
while ((e == NULL || p < e) && ISDIGIT(*p)) {
ch = *p - '0';
int ch = *p - '0';
if (mrb_int_mul_overflow(n, 10, &n) ||
mrb_int_add_overflow(n, ch, &n)) {
return FALSE;