summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-11-08 12:44:31 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2015-11-08 12:44:31 -0800
commit30b90f166ef0ca0883985461d498c066e4f723da (patch)
treef495e122d814d9216d8cf49985240a5a7b685f34
parent7277cc1bedaa335b96ce609b4390618358198c32 (diff)
downloadzsh-30b90f166ef0ca0883985461d498c066e4f723da.tar.gz
zsh-30b90f166ef0ca0883985461d498c066e4f723da.tar.xz
zsh-30b90f166ef0ca0883985461d498c066e4f723da.zip
37080: use paramtab abstraction more consistently, add explanatory comments
-rw-r--r--ChangeLog3
-rw-r--r--Src/builtin.c11
-rw-r--r--Src/params.c6
3 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index cee715d33..110f10743 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-11-08  Barton E. Schaefer  <schaefer@brasslantern.com>
 
+	* 37080: Src/builtin.c, Src/params.c: use paramtab abstraction more
+	consistently, add explanatory comments
+
 	* 37079: Etc/zsh-development-guide: better description of "optstr"
 	field in struct builtin as used in BUILTIN() macro
 
diff --git a/Src/builtin.c b/Src/builtin.c
index 0be20a5d2..18dfdce05 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2334,7 +2334,8 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	} else if ((on & PM_LOCAL) && locallevel) {
 	    *subscript = 0;
 	    pm = (Param) (paramtab == realparamtab ?
-			  gethashnode2(paramtab, pname) :
+			  /* getnode2() to avoid autoloading */
+			  paramtab->getnode2(paramtab, pname) :
 			  paramtab->getnode(paramtab, pname));
 	    *subscript = '[';
 	    if (!pm || pm->level != locallevel) {
@@ -2825,11 +2826,12 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
     /* Take arguments literally.  Don't glob */
     while ((asg = getasg(&argv, assigns))) {
 	HashNode hn = (paramtab == realparamtab ?
-		       gethashnode2(paramtab, asg->name) :
+		       /* getnode2() to avoid autoloading */
+		       paramtab->getnode2(paramtab, asg->name) :
 		       paramtab->getnode(paramtab, asg->name));
 	if (OPT_ISSET(ops,'p')) {
 	    if (hn)
-		printparamnode(hn, printflags);
+		paramtab->printnode(hn, printflags);
 	    else {
 		zwarnnam(name, "no such variable: %s", asg->name);
 		returnval = 1;
@@ -3319,7 +3321,8 @@ bin_unset(char *name, char **argv, Options ops, int func)
 	    *ss = 0;
 	}
 	pm = (Param) (paramtab == realparamtab ?
-		      gethashnode2(paramtab, s) :
+		      /* getnode2() to avoid autoloading */
+		      paramtab->getnode2(paramtab, s) :
 		      paramtab->getnode(paramtab, s));
 	/*
 	 * Unsetting an unset variable is not an error.
diff --git a/Src/params.c b/Src/params.c
index de456c144..3ed771e3b 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -447,7 +447,7 @@ newparamtable(int size, char const *name)
     ht->cmpnodes    = strcmp;
     ht->addnode     = addhashnode;
     ht->getnode     = getparamnode;
-    ht->getnode2    = getparamnode;
+    ht->getnode2    = gethashnode2;
     ht->removenode  = removehashnode;
     ht->disablenode = NULL;
     ht->enablenode  = NULL;
@@ -869,6 +869,7 @@ createparam(char *name, int flags)
 
     if (name != nulstring) {
 	oldpm = (Param) (paramtab == realparamtab ?
+			 /* gethashnode2() for direct table read */
 			 gethashnode2(paramtab, name) :
 			 paramtab->getnode(paramtab, name));
 
@@ -3111,7 +3112,8 @@ unsetparam(char *s)
 
     queue_signals();
     if ((pm = (Param) (paramtab == realparamtab ?
-		       gethashnode2(paramtab, s) :
+		       /* getnode2() to avoid autoloading */
+		       paramtab->getnode2(paramtab, s) :
 		       paramtab->getnode(paramtab, s))))
 	unsetparam_pm(pm, 0, 1);
     unqueue_signals();