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

32569: lastval ($?) should not be reset between word list substitution and loop body execution in for/select

Remove one other redundant and therefore confusing assignment to lastval.
This commit is contained in:
Barton E. Schaefer 2014-04-20 11:09:51 -07:00
parent 848badaa5f
commit 9da59238ff
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,8 @@
2014-04-20 Barton E. Schaefer <schaefer@zsh.org> 2014-04-20 Barton E. Schaefer <schaefer@zsh.org>
* 32569: Src/loop.c: lastval ($?) should not be reset between
word list substitution and loop body execution in for/select.
* 32568: Src/exec.c, Src/loop.c: consistency in handling of errflag * 32568: Src/exec.c, Src/loop.c: consistency in handling of errflag
condition during substitutions in for/select word lists, function condition during substitutions in for/select word lists, function
definition name position, and anonymous function argument lists. definition name position, and anonymous function argument lists.

View file

@ -73,7 +73,7 @@ execfor(Estate state, int do_exec)
matheval(str); matheval(str);
if (errflag) { if (errflag) {
state->pc = end; state->pc = end;
return lastval = errflag; return 1;
} }
cond = ecgetstr(state, EC_NODUP, &ctok); cond = ecgetstr(state, EC_NODUP, &ctok);
advance = ecgetstr(state, EC_NODUP, &atok); advance = ecgetstr(state, EC_NODUP, &atok);
@ -102,7 +102,7 @@ execfor(Estate state, int do_exec)
addlinknode(args, dupstring(*x)); addlinknode(args, dupstring(*x));
} }
} }
lastval = 0; /* lastval = 0; */
loops++; loops++;
pushheap(); pushheap();
cmdpush(CS_FOR); cmdpush(CS_FOR);
@ -241,7 +241,7 @@ execselect(Estate state, UNUSED(int do_exec))
return 1; return 1;
} }
loops++; loops++;
lastval = 0; /* lastval = 0; */
pushheap(); pushheap();
cmdpush(CS_SELECT); cmdpush(CS_SELECT);
usezle = interact && SHTTY != -1 && isset(USEZLE); usezle = interact && SHTTY != -1 && isset(USEZLE);