aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2014-04-13 14:30:56 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2014-04-13 14:30:56 -0400
commit94e3f93395de538d73826e128281a3ea9591a5a9 (patch)
tree45257e4b024537c5e0e5a3037a99ea9765583c99 /array.c
parentc4300d657ba49db0b6d0f0884f41a29622edc58b (diff)
parenta4b59faf911743b30f2e6e979c4f9c1ea0669ac3 (diff)
downloadegawk-94e3f93395de538d73826e128281a3ea9591a5a9.tar.gz
egawk-94e3f93395de538d73826e128281a3ea9591a5a9.tar.bz2
egawk-94e3f93395de538d73826e128281a3ea9591a5a9.zip
Merge branch 'master' into select
Diffstat (limited to 'array.c')
-rw-r--r--array.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/array.c b/array.c
index 92a1cb8e..682b8ddb 100644
--- a/array.c
+++ b/array.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2013 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2014 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -113,21 +113,14 @@ null_array(NODE *symbol)
symbol->table_size = symbol->array_size = 0;
symbol->array_capacity = 0;
symbol->flags = 0;
- /*
- * 5/2013: This used to be
- *
- * assert(symbol->xarray == NULL);
- *
- * But that seems to cause problems for no good reason
- * that I can see. I believe it to be an artifact of the
- * union getting in the way.
- */
- symbol->xarray = NULL;
+
+ assert(symbol->xarray == NULL);
+
/* vname, parent_array not (re)initialized */
}
-/* null_lookup: assign type to an empty array. */
+/* null_lookup --- assign type to an empty array. */
static NODE **
null_lookup(NODE *symbol, NODE *subs)
@@ -349,6 +342,7 @@ force_array(NODE *symbol, bool canfatal)
switch (symbol->type) {
case Node_var_new:
+ symbol->xarray = NULL; /* make sure union is as it should be */
null_array(symbol);
symbol->parent_array = NULL; /* main array has no parent */
/* fall through */
@@ -854,6 +848,8 @@ asort_actual(int nargs, sort_context_t ctxt)
/* source array is empty */
if (dest != NULL && dest != array)
assoc_clear(dest);
+ if (list != NULL)
+ efree(list);
return make_number((AWKNUM) 0);
}
@@ -1283,7 +1279,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt)
INSTRUCTION *code = NULL;
extern int currule;
int save_rule = 0;
- assoc_kind_t assoc_kind = 0;
+ assoc_kind_t assoc_kind = ANONE;
elem_size = 1;