diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-09-23 19:23:53 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-09-25 20:03:05 +0100 |
commit | 7d4b41b52aeabb6f6f95f9bdfdab96b5fd66909a (patch) | |
tree | 33b8aade0a993399a1bd67089a86a042862eaa31 /Src/params.c | |
parent | 9cab4c3d7f098e0ca48083c2e4714fab812c5b39 (diff) | |
download | zsh-7d4b41b52aeabb6f6f95f9bdfdab96b5fd66909a.tar.gz zsh-7d4b41b52aeabb6f6f95f9bdfdab96b5fd66909a.tar.xz zsh-7d4b41b52aeabb6f6f95f9bdfdab96b5fd66909a.zip |
41747: Don't create hash entry if just checking existence.
Pass a flag in indicating this case.
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Src/params.c b/Src/params.c index c7514de8a..4d4d08085 100644 --- a/Src/params.c +++ b/Src/params.c @@ -1204,7 +1204,7 @@ isident(char *s) /**/ static zlong getarg(char **str, int *inv, Value v, int a2, zlong *w, - int *prevcharlen, int *nextcharlen) + int *prevcharlen, int *nextcharlen, int flags) { int hasbeg = 0, word = 0, rev = 0, ind = 0, down = 0, l, i, ishash; int keymatch = 0, needtok = 0, arglen, len, inpar = 0; @@ -1407,6 +1407,8 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w, if (ishash) { HashTable ht = v->pm->gsu.h->getfn(v->pm); if (!ht) { + if (flags & SCANPM_CHECKING) + return isset(KSHARRAYS) ? 1 : 0; ht = newparamtable(17, v->pm->node.nam); v->pm->gsu.h->setfn(v->pm, ht); } @@ -1848,7 +1850,8 @@ getindex(char **pptr, Value v, int flags) zlong we = 0, dummy; int startprevlen, startnextlen; - start = getarg(&s, &inv, v, 0, &we, &startprevlen, &startnextlen); + start = getarg(&s, &inv, v, 0, &we, &startprevlen, &startnextlen, + flags); if (inv) { if (!v->isarr && start != 0) { @@ -1922,7 +1925,7 @@ getindex(char **pptr, Value v, int flags) if ((com = (*s == ','))) { s++; - end = getarg(&s, &inv, v, 1, &dummy, NULL, NULL); + end = getarg(&s, &inv, v, 1, &dummy, NULL, NULL, flags); } else { end = we ? we : start; } |