aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:18:27 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:18:27 +0300
commite1ef22d366abd1f9ec95eb495c727d55181c8584 (patch)
treecc0fee624202820eb928e60b6a096362c85ff807 /array.c
parentcae8bc6ced84c12590e3554a06a952283735363a (diff)
downloadegawk-e1ef22d366abd1f9ec95eb495c727d55181c8584.tar.gz
egawk-e1ef22d366abd1f9ec95eb495c727d55181c8584.tar.bz2
egawk-e1ef22d366abd1f9ec95eb495c727d55181c8584.zip
Move to 2.15.
Diffstat (limited to 'array.c')
-rw-r--r--array.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/array.c b/array.c
index a5f5c754..59be340c 100644
--- a/array.c
+++ b/array.c
@@ -203,11 +203,24 @@ NODE *symbol, *subs;
/* It's not there, install it. */
if (do_lint && subs->stlen == 0)
- warning("subscript of array is null string");
+ warning("subscript of array `%s' is null string",
+ symbol->vname);
getnode(bucket);
bucket->type = Node_ahash;
- bucket->ahname = dupnode(subs);
+ if (subs->flags & TEMP)
+ bucket->ahname = dupnode(subs);
+ else {
+ unsigned int saveflags = subs->flags;
+
+ subs->flags &= ~MALLOC;
+ bucket->ahname = dupnode(subs);
+ subs->flags = saveflags;
+ }
free_temp(subs);
+
+ /* array subscripts are strings */
+ bucket->ahname->flags &= ~NUMBER;
+ bucket->ahname->flags |= STRING;
bucket->ahvalue = Nnull_string;
bucket->ahnext = symbol->var_array[hash1];
symbol->var_array[hash1] = bucket;