From e1ef22d366abd1f9ec95eb495c727d55181c8584 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 16 Jul 2010 12:18:27 +0300 Subject: Move to 2.15. --- array.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'array.c') 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; -- cgit v1.2.3