aboutsummaryrefslogtreecommitdiff
path: root/shell/math.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-05-26 14:02:10 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-05-26 14:02:10 +0200
commit8b35f207bbd91a5bbca816dbdf5f8f33dd57f19d (patch)
tree8f25306a11f796fa31e9e2a6460addfdd955f39d /shell/math.c
parent9501bc7da5f560f3dae6f6a1d2b11efa9d5dfe47 (diff)
downloadbusybox-8b35f207bbd91a5bbca816dbdf5f8f33dd57f19d.tar.gz
shell: move all definitions of strto_arith_t() together
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/math.c')
-rw-r--r--shell/math.c10
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)
*endptr = (char*)nptr;
return n;
}
-#define strto_arith_t(nptr, endptr, base_is_always_0) \
- strto_arith_t(nptr, endptr)
+#else /* !ENABLE_FEATURE_SH_MATH_BASE */
+# if ENABLE_FEATURE_SH_MATH_64
+# define strto_arith_t(nptr, endptr) strtoull(nptr, endptr, 0)
+# else
+# define strto_arith_t(nptr, endptr) strtoul(nptr, endptr, 0)
+# endif
#endif
static arith_t FAST_FUNC
@@ -627,7 +631,7 @@ evaluate_string(arith_state_t *math_state, const char *expr)
/* Number */
numstackptr->var = NULL;
errno = 0;
- numstackptr->val = strto_arith_t(expr, (char**) &expr, 0);
+ numstackptr->val = strto_arith_t(expr, (char**) &expr);
if (errno)
numstackptr->val = 0; /* bash compat */
goto num;