summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/parameter.c4
-rw-r--r--Test/V06parameter.ztst6
3 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f24ac959..09e9b62f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-08  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 40508: Src/Modules/parameter.c, Test/V06parameter.ztst:
+	Make $functions re-settable.
+
 2017-02-07  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* Sebastian: 40507: Src/Modules/db_gdbm.c: remove extraneous
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 6e6228732..c251e4f97 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 10e0a276e..27d587852 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