diff options
Diffstat (limited to 'shell/math.c')
-rw-r--r-- | shell/math.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/shell/math.c b/shell/math.c index 2ea0317e9..eaf4f2453 100644 --- a/shell/math.c +++ b/shell/math.c | |||
@@ -545,8 +545,12 @@ static arith_t strto_arith_t(const char *nptr, char **endptr) | |||
545 | *endptr = (char*)nptr; | 545 | *endptr = (char*)nptr; |
546 | return n; | 546 | return n; |
547 | } | 547 | } |
548 | #define strto_arith_t(nptr, endptr, base_is_always_0) \ | 548 | #else /* !ENABLE_FEATURE_SH_MATH_BASE */ |
549 | strto_arith_t(nptr, endptr) | 549 | # if ENABLE_FEATURE_SH_MATH_64 |
550 | # define strto_arith_t(nptr, endptr) strtoull(nptr, endptr, 0) | ||
551 | # else | ||
552 | # define strto_arith_t(nptr, endptr) strtoul(nptr, endptr, 0) | ||
553 | # endif | ||
550 | #endif | 554 | #endif |
551 | 555 | ||
552 | static arith_t FAST_FUNC | 556 | static arith_t FAST_FUNC |
@@ -627,7 +631,7 @@ evaluate_string(arith_state_t *math_state, const char *expr) | |||
627 | /* Number */ | 631 | /* Number */ |
628 | numstackptr->var = NULL; | 632 | numstackptr->var = NULL; |
629 | errno = 0; | 633 | errno = 0; |
630 | numstackptr->val = strto_arith_t(expr, (char**) &expr, 0); | 634 | numstackptr->val = strto_arith_t(expr, (char**) &expr); |
631 | if (errno) | 635 | if (errno) |
632 | numstackptr->val = 0; /* bash compat */ | 636 | numstackptr->val = 0; /* bash compat */ |
633 | goto num; | 637 | goto num; |