1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-20 06:56:05 +02:00

36347: Fix appending empty array to associations

This commit is contained in:
Mikael Magnusson 2015-08-31 14:52:59 +02:00
parent cbe00216fe
commit 8e3ca08f13
3 changed files with 21 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2015-09-01 Mikael Magnusson <mikachu@gmail.com>
* 36380: Src/utils.c: Avoid gcc case syntax
* 36347: Src/params.c, Test/A06assign.ztst: Fix appending empty
array to associations
2015-09-01 Barton E. Schaefer <schaefer@zsh.org>
* 36376: Src/utils.c: handle signals during read1char() so it is

View File

@ -3312,9 +3312,12 @@ arrhashsetfn(Param pm, char **val, int augment)
zerr("bad set of key/value pairs for associative array");
return;
}
if (alen)
if (!(augment && (ht = paramtab = pm->gsu.h->getfn(pm))))
ht = paramtab = newparamtable(17, pm->node.nam);
if (augment) {
ht = paramtab = pm->gsu.h->getfn(pm);
}
if (alen && (!augment || !paramtab)) {
ht = paramtab = newparamtable(17, pm->node.nam);
}
while (*aptr) {
/* The parameter name is ztrdup'd... */
v->pm = createparam(*aptr, PM_SCALAR|PM_UNSET);

View File

@ -249,6 +249,14 @@
>2
>3
typeset -A h
h=(a 1 b 2)
h+=()
print -l $h
0:add empty array to association
>1
>2
# tests of var[range]+=scalar
s=sting