From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: PATCH: Re: Possible bug with ${(A)foo=} and ${(AA)foo=}
Date: Thu, 24 Jun 1999 15:36:03 +0000 [thread overview]
Message-ID: <990624153603.ZM1719@candle.brasslantern.com> (raw)
In-Reply-To: <9906231002.AA17151@ibmth.df.unipi.it>
On Jun 23, 12:02pm, Peter Stephenson wrote:
} Subject: Re: Possible bug with ${(A)foo=} and ${(AA)foo=}
}
} Without fixing the general array-splitting problem, which is difficult, I
} don't see there's any problem deciding what to do in the case of an
} associative array, since the intention in such a case can only be to create
} an empty one because there is no key/value pair, even with ${(AA)foo=''}
OK, then ... here's a companion patch which defers allocation of the hash
table when there's nothing to put into it.
Index: Src/params.c
===================================================================
@@ -1898,7 +1898,7 @@
* since that could cause trouble for special hashes. This way, *
* it's up to pm->sets.hfn() what to do. */
int alen = arrlen(val);
- HashTable opmtab = paramtab, ht;
+ HashTable opmtab = paramtab, ht = 0;
char **aptr = val;
Value v = (Value) hcalloc(sizeof *v);
v->b = -1;
@@ -1909,7 +1909,8 @@
NULL, 0);
return;
}
- ht = paramtab = newparamtable(17, pm->nam);
+ if (alen)
+ ht = paramtab = newparamtable(17, pm->nam);
while (*aptr) {
/* The parameter name is ztrdup'd... */
v->pm = createparam(*aptr, PM_SCALAR|PM_UNSET);
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
prev parent reply other threads:[~1999-06-24 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-22 16:13 Andrej Borsenkow
1999-06-22 17:36 ` Bart Schaefer
1999-06-23 10:02 ` Peter Stephenson
1999-06-24 15:36 ` Bart Schaefer [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=990624153603.ZM1719@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=zsh-workers@sunsite.auc.dk \
/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).