shell: unify endofname() in hush and ash
function old new delta builtin_umask 132 133 +1 changepath 195 194 -1 expand_and_evaluate_arith 77 69 -8 ash_arith 143 135 -8 expand_one_var 1551 1515 -36 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53) Total: -52 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
14
shell/math.c
14
shell/math.c
@@ -122,7 +122,7 @@
|
||||
#define a_e_h_t arith_eval_hooks_t
|
||||
#define lookupvar (math_hooks->lookupvar)
|
||||
#define setvar (math_hooks->setvar )
|
||||
#define endofname (math_hooks->endofname)
|
||||
//#define endofname (math_hooks->endofname)
|
||||
|
||||
#define arith_isspace(arithval) \
|
||||
(arithval == ' ' || arithval == '\n' || arithval == '\t')
|
||||
@@ -479,6 +479,18 @@ static const char op_tokens[] ALIGN1 = {
|
||||
/* ptr to ")" */
|
||||
#define endexpression (&op_tokens[sizeof(op_tokens)-7])
|
||||
|
||||
const char* FAST_FUNC
|
||||
endofname(const char *name)
|
||||
{
|
||||
if (!is_name(*name))
|
||||
return name;
|
||||
while (*++name) {
|
||||
if (!is_in_name(*name))
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
arith_t
|
||||
arith(const char *expr, int *perrcode, a_e_h_t *math_hooks)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user