1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 22:11:54 +02:00

unposted: rewrite Nularg math handling to be like other cases

This commit is contained in:
Peter Stephenson 2015-04-15 18:14:27 +01:00
parent 2ef4b38461
commit 493fe2b444
2 changed files with 9 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2015-04-15 Peter Stephenson <p.stephenson@samsung.com>
* unposted: Src/math.c: rewrite last commit to look more
like other uses of Nularg.
* 34892 (slightly tweaked): Src/math.c, Test/C01arith.ztst: fix
math evaluation with empty expression resulting from substitution.

View file

@ -1398,7 +1398,9 @@ matheval(char *s)
if (!mlevel)
outputradix = outputunderscore = 0;
if (!*s || *s == Nularg) {
if (*s == Nularg)
s++;
if (!*s) {
x.type = MN_INTEGER;
x.u.l = 0;
return x;
@ -1435,7 +1437,9 @@ mathevalarg(char *s, char **ss)
*
* To avoid a more opaque error further in, bail out here.
*/
if (!*s || *s == Nularg) {
if (*s == Nularg)
s++;
if (!*s) {
zerr("bad math expression: empty string");
return (zlong)0;
}