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

PATCH: 3.0.6-pre-3: parameter fixes



These are the two parameter fixes adapted for 3.0.6:  first, typeset -m
restored unset parameters which hadn't been removed from the table; second,
in fn1() { local foo; unset foo; foo=bar; }, foo is restored at local
level, while if the `unset foo' appeared in a nested function it would have
been restored at global level, which is presumably wrong, depending what
`wrong' means.

--- Src/builtin.c.pm	Tue Jun  1 12:02:43 1999
+++ Src/builtin.c	Tue Jun  1 12:13:26 1999
@@ -2986,6 +2986,8 @@
 	    for (i = 0; i < paramtab->hsize; i++) {
 		for (pm = (Param) paramtab->nodes[i]; pm;
 		     pm = (Param) pm->next) {
+		    if (pm->flags & PM_UNSET)
+			continue;
 		    if (domatch(pm->nam, com, 0))
 			addlinknode(pmlist, pm);
 		}
--- Src/params.c.pm	Thu Apr 29 10:08:40 1999
+++ Src/params.c	Tue Jun  1 12:09:28 1999
@@ -1121,7 +1121,7 @@
 	    unsetparam_pm(altpm, 1);
     }
 
-    if ((locallevel && locallevel == pm->level) || spec) {
+    if ((pm->level && locallevel >= pm->level) || spec) {
 	pm->flags |= PM_UNSET;
 	return;
     }

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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