shell: move all definitions of strto_arith_t() together
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
9501bc7da5
commit
8b35f207bb
10
shell/math.c
10
shell/math.c
@ -545,8 +545,12 @@ static arith_t strto_arith_t(const char *nptr, char **endptr)
|
|||||||
*endptr = (char*)nptr;
|
*endptr = (char*)nptr;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
#define strto_arith_t(nptr, endptr, base_is_always_0) \
|
#else /* !ENABLE_FEATURE_SH_MATH_BASE */
|
||||||
strto_arith_t(nptr, endptr)
|
# 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
|
#endif
|
||||||
|
|
||||||
static arith_t FAST_FUNC
|
static arith_t FAST_FUNC
|
||||||
@ -627,7 +631,7 @@ evaluate_string(arith_state_t *math_state, const char *expr)
|
|||||||
/* Number */
|
/* Number */
|
||||||
numstackptr->var = NULL;
|
numstackptr->var = NULL;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
numstackptr->val = strto_arith_t(expr, (char**) &expr, 0);
|
numstackptr->val = strto_arith_t(expr, (char**) &expr);
|
||||||
if (errno)
|
if (errno)
|
||||||
numstackptr->val = 0; /* bash compat */
|
numstackptr->val = 0; /* bash compat */
|
||||||
goto num;
|
goto num;
|
||||||
|
@ -71,14 +71,6 @@ typedef long arith_t;
|
|||||||
# define ARITH_FMT "%ld"
|
# define ARITH_FMT "%ld"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !ENABLE_FEATURE_SH_MATH_BASE
|
|
||||||
# if ENABLE_FEATURE_SH_MATH_64
|
|
||||||
# define strto_arith_t strtoull
|
|
||||||
# else
|
|
||||||
# define strto_arith_t strtoul
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef const char* FAST_FUNC (*arith_var_lookup_t)(const char *name);
|
typedef const char* FAST_FUNC (*arith_var_lookup_t)(const char *name);
|
||||||
typedef void FAST_FUNC (*arith_var_set_t)(const char *name, const char *val);
|
typedef void FAST_FUNC (*arith_var_set_t)(const char *name, const char *val);
|
||||||
//typedef const char* FAST_FUNC (*arith_var_endofname_t)(const char *name);
|
//typedef const char* FAST_FUNC (*arith_var_endofname_t)(const char *name);
|
||||||
|
Loading…
Reference in New Issue
Block a user