Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Make $functions re-settable.
- X-seq: zsh-workers 40508
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Make $functions re-settable.
- Date: Tue, 7 Feb 2017 04:28:50 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=fLCTOOf6otGLHKja1JBgIJxw5sI=; b=llViZU t/Dqo2EcJnYRWD9+ya/g+pwJnRKMF3oBnp/tvF9xLFD3A8EuVh0LcXpbx78f8kR6 GUodsdD0/+ciEZiPs1YIn7dL83zBfTETxlKkcZShOJJ+B5Wk+92GDdHloK5hU9E1 s9AIxlD77CmXY7+wjgzccwY1+uV8rd1IC/t30=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=fLCTOOf6otGLHKja1JBgIJxw5sI=; b=k2Hg9 fI05F6ai67epdOmWd+ZT00+wtF/72gjKn8t87O5MHW/2/L2HQpSZRg/r0mkSyFJW +ltsQ9b6rUZYMwSBeSOnmFJu+GayURblNsJ/rAx5gEjkmofkqybQe8fA9rr9TUuO CsCD/HRdTVn0l6sPF0WwRyV23/R3+tgrf0frRQ=
- In-reply-to: <20170206190308.GA16316@breadbox.private.spodhuis.org>
- 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
- References: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author