Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: paramtab abstraction sanity
- X-seq: zsh-workers 37080
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: paramtab abstraction sanity
- Date: Sun, 8 Nov 2015 12:09:59 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version:content-type; bh=hLhWE2ykey7Ux89t28wTYtbiCorOlI1Y1vvhR4c2TSs=; b=YSzaw64PwHjHanBfb2eh89gknUPXYc//0MyGckp7/zKHJFIyM9fODsiojuhl9lDnLh UFw6psYs/KD6MNWlPNi5m/ScMynzTry3efBMdE/S14jkeX8nycQtecZPCjSWKmKFgr0/ v/rZj3HrfR1saOZ+tSKE77STCcaLcU+9qql6jjCCi+XH7NzQobge3G0Fa2h0L9NZdKIG +EChursZbh95KUBd8AaVHBgUwogld7UmxaznlAso1uH+SQ6LDAkgxo9Ir+/p3PhHiMpb B5J2SJ2ttVmLwsP0vP7IBhIAHYyt2V8Tb/F2QiTEAYW3bq9TZ39fL0sjWNwMW1H+KGVp veqQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This fixes a few places where the code was ignoring the paramtab accessor
function abstraction, or adds comments explaining why the abstraction is
being bypassed.
diff --git a/Src/builtin.c b/Src/builtin.c
index 0be20a5..18dfdce 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 de456c1..3ed771e 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();
Messages sorted by:
Reverse Date,
Date,
Thread,
Author