Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Test Failures from latest CVS



On Sun, 5 Sep 2004, Peter Stephenson wrote:

> Bart Schaefer wrote:
> > (Is there a reason not to assign lastval in that case also?  It could 
> > simplify the code structure.)
> 
> I don't think there's a reason *not* to; it's just not necessary because 
> in any case on return from bin_eval it gets set to the 1 we just 
> returned.

In that case, and in the interests of reducing entropy, I suggest the
following, which I've presented as a context diff rather than unified
so you can see the complete final code in the bottom half:

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.124
diff -c -r1.124 builtin.c
*** Src/builtin.c	4 Sep 2004 16:59:35 -0000	1.124
--- Src/builtin.c	5 Sep 2004 18:09:42 -0000
***************
*** 4239,4260 ****
  	scriptname = "(eval)";
  
      prog = parse_string(zjoin(argv, ' ', 1));
!     if (!prog) {
! 	errflag = 0;
!         scriptname = oscriptname;
!         ineval = oineval;
! 	return 1;
!     }
  
!     lastval = 0;
  
!     execode(prog, 1, 0);
! 
!     if (errflag) {
! 	lastval = errflag;
! 	errflag = 0;
      }
  
      scriptname = oscriptname;
      ineval = oineval;
  
--- 4239,4257 ----
  	scriptname = "(eval)";
  
      prog = parse_string(zjoin(argv, ' ', 1));
!     if (prog) {
! 	lastval = 0;
  
! 	execode(prog, 1, 0);
  
! 	if (errflag)
! 	    lastval = errflag;
!     } else {
! 	lastval = 1;
      }
  
+ 
+     errflag = 0;
      scriptname = oscriptname;
      ineval = oineval;
  



Messages sorted by: Reverse Date, Date, Thread, Author