ash: improve readability of the code. No real code changes.
This commit is contained in:
parent
ef527f50e6
commit
2b75a94118
18
shell/ash.c
18
shell/ash.c
@ -11146,7 +11146,8 @@ xxreadtoken(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lasttoken = xxreadtoken_tokens[p - xxreadtoken_chars];
|
lasttoken = xxreadtoken_tokens[p - xxreadtoken_chars];
|
||||||
|
return lasttoken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* for */
|
} /* for */
|
||||||
@ -12997,21 +12998,19 @@ arith(const char *expr, int *perrcode)
|
|||||||
char arithval; /* Current character under analysis */
|
char arithval; /* Current character under analysis */
|
||||||
operator lasttok, op;
|
operator lasttok, op;
|
||||||
operator prec;
|
operator prec;
|
||||||
|
operator *stack, *stackptr;
|
||||||
const char *p = endexpression;
|
const char *p = endexpression;
|
||||||
int errcode;
|
int errcode;
|
||||||
|
v_n_t *numstack, *numstackptr;
|
||||||
size_t datasizes = strlen(expr) + 2;
|
unsigned datasizes = strlen(expr) + 2;
|
||||||
|
|
||||||
/* Stack of integers */
|
/* Stack of integers */
|
||||||
/* The proof that there can be no more than strlen(startbuf)/2+1 integers
|
/* The proof that there can be no more than strlen(startbuf)/2+1 integers
|
||||||
* in any given correct or incorrect expression is left as an exercise to
|
* in any given correct or incorrect expression is left as an exercise to
|
||||||
* the reader. */
|
* the reader. */
|
||||||
v_n_t *numstack = alloca(((datasizes)/2)*sizeof(v_n_t)),
|
numstackptr = numstack = alloca((datasizes / 2) * sizeof(numstack[0]));
|
||||||
*numstackptr = numstack;
|
|
||||||
/* Stack of operator tokens */
|
/* Stack of operator tokens */
|
||||||
operator *stack = alloca((datasizes) * sizeof(operator)),
|
stackptr = stack = alloca(datasizes * sizeof(stack[0]));
|
||||||
*stackptr = stack;
|
|
||||||
|
|
||||||
*stackptr++ = lasttok = TOK_LPAREN; /* start off with a left paren */
|
*stackptr++ = lasttok = TOK_LPAREN; /* start off with a left paren */
|
||||||
*perrcode = errcode = 0;
|
*perrcode = errcode = 0;
|
||||||
@ -13040,7 +13039,8 @@ arith(const char *expr, int *perrcode)
|
|||||||
if (numstackptr != numstack+1) {
|
if (numstackptr != numstack+1) {
|
||||||
/* ... but if there isn't, it's bad */
|
/* ... but if there isn't, it's bad */
|
||||||
err:
|
err:
|
||||||
return (*perrcode = -1);
|
*perrcode = -1;
|
||||||
|
return *perrcode;
|
||||||
}
|
}
|
||||||
if (numstack->var) {
|
if (numstack->var) {
|
||||||
/* expression is $((var)) only, lookup now */
|
/* expression is $((var)) only, lookup now */
|
||||||
|
Loading…
Reference in New Issue
Block a user