From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] Make $functions re-settable.
Date: Tue, 7 Feb 2017 04:28:50 +0000 [thread overview]
Message-ID: <1486441730-20788-1-git-send-email-danielsh@fujitsu.shahaf.local2> (raw)
In-Reply-To: <20170206190308.GA16316@breadbox.private.spodhuis.org>
---
Unlike the standard hash setter, setfunctions() wasn't checking that ht !=
pm->u.hash. Rather than reimplement that, I chose (perhaps overzealously) to
delegate to the standard setter.
Cheers,
Daniel
Src/Modules/parameter.c | 4 ++--
Test/V06parameter.ztst | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 6e62287..c251e4f 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -330,7 +330,7 @@ unsetpmfunction(Param pm, UNUSED(int exp))
/**/
static void
-setfunctions(UNUSED(Param pm), HashTable ht, int dis)
+setfunctions(Param pm, HashTable ht, int dis)
{
int i;
HashNode hn;
@@ -349,7 +349,7 @@ setfunctions(UNUSED(Param pm), HashTable ht, int dis)
setfunction(hn->nam, ztrdup(getstrvalue(&v)), dis);
}
- deleteparamtable(ht);
+ hashsetfn(pm, ht);
}
/**/
diff --git a/Test/V06parameter.ztst b/Test/V06parameter.ztst
index 10e0a27..27d5878 100644
--- a/Test/V06parameter.ztst
+++ b/Test/V06parameter.ztst
@@ -86,6 +86,12 @@
>I have been autoloaded
>$mydir/myfunc
+ functions+=(a 'echo foo'); a
+ functions+=(a 'echo bar'); a
+0:$functions can be appended to twice
+>foo
+>bar
+
%clean
rm -f autofn functrace.zsh rocky3.zsh sourcedfile myfunc
prev parent reply other threads:[~2017-02-07 4:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 19:03 crash / 5.3.1 / functions array acces Phil Pennock
2017-02-06 20:15 ` Sebastian Gniazdowski
2017-02-06 20:51 ` Axel Beckert
2017-02-07 4:28 ` Daniel Shahaf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486441730-20788-1-git-send-email-danielsh@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).