about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-02-24 05:17:04 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-02-25 08:05:11 +0000
commit6c476c22111122006dcacc767b2c2846ede881e8 (patch)
treee56e37dae2e03cf23992731092d835418915f0ab
parentdb44b17150b05be43f5eff7e6cc5fe474fce5087 (diff)
downloadzsh-6c476c22111122006dcacc767b2c2846ede881e8.tar.gz
zsh-6c476c22111122006dcacc767b2c2846ede881e8.tar.xz
zsh-6c476c22111122006dcacc767b2c2846ede881e8.zip
40626: Make $options re-settable.
Follow-up to 40508.

Reported-by: James McGlashan
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/parameter.c4
-rw-r--r--Test/V06parameter.ztst3
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a069b209..fbedf0ae2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-25  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 40626: Src/Modules/parameter.c, Test/V06parameter.ztst:
+	Make $options re-settable.
+
 2017-02-23  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* unposted (cf. 40617): Doc/Zsh/expn.yo: clarify description of
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index c251e4f97..c7aac88d1 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -937,7 +937,7 @@ unsetpmoption(Param pm, UNUSED(int exp))
 
 /**/
 static void
-setpmoptions(UNUSED(Param pm), HashTable ht)
+setpmoptions(Param pm, HashTable ht)
 {
     int i;
     HashNode hn;
@@ -962,7 +962,7 @@ setpmoptions(UNUSED(Param pm), HashTable ht)
 			      (val && strcmp(val, "off")), 0, opts))
 		zwarn("can't change option: %s", hn->nam);
 	}
-    deleteparamtable(ht);
+    hashsetfn(pm, ht);
 }
 
 static const struct gsu_scalar pmoption_gsu =
diff --git a/Test/V06parameter.ztst b/Test/V06parameter.ztst
index 27d587852..2b6671300 100644
--- a/Test/V06parameter.ztst
+++ b/Test/V06parameter.ztst
@@ -92,6 +92,9 @@
 >foo
 >bar
 
+ options+=(); options+=()
+0:$options can be appended to twice
+
 %clean
 
  rm -f autofn functrace.zsh rocky3.zsh sourcedfile myfunc