From 73d24cae0db6cc817db209e5e1ea93b0733d1cca Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 26 Dec 2011 23:39:48 +0200 Subject: The grand merge: dgawk and pgawk folded into gawk. --- str_array.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'str_array.c') diff --git a/str_array.c b/str_array.c index 8fb6ba8a..be431e5d 100644 --- a/str_array.c +++ b/str_array.c @@ -191,7 +191,8 @@ str_exists(NODE *symbol, NODE *subs) unsigned long hash1; size_t code1; - assert(symbol->table_size > 0); + if (symbol->table_size == 0) + return NULL; subs = force_string(subs); hash1 = hash(subs->stptr, subs->stlen, (unsigned long) symbol->array_size, & code1); @@ -242,7 +243,8 @@ str_remove(NODE *symbol, NODE *subs) NODE *s2; size_t s1_len; - assert(symbol->table_size > 0); + if (symbol->table_size == 0) + return NULL; s2 = force_string(subs); hash1 = hash(s2->stptr, s2->stlen, (unsigned long) symbol->array_size, NULL); @@ -358,7 +360,8 @@ str_list(NODE *symbol, NODE *t) unsigned long num_elems, list_size, i, k = 0; int elem_size = 1; - assert(symbol->table_size > 0); + if (symbol->table_size == 0) + return NULL; if ((t->flags & (AINDEX|AVALUE)) == (AINDEX|AVALUE)) elem_size = 2; -- cgit v1.2.3 From 23d37c1740baeaebefd8310c53b232904c1e1f77 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 28 Dec 2011 18:12:21 +0200 Subject: Fix compiler warnings on printf calls. --- str_array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'str_array.c') diff --git a/str_array.c b/str_array.c index be431e5d..0b17796c 100644 --- a/str_array.c +++ b/str_array.c @@ -446,7 +446,7 @@ str_dump(NODE *symbol, NODE *ndump) fprintf(output_fp, "flags: %s\n", flags2str(symbol->flags)); } indent(indent_level); - fprintf(output_fp, "STR_CHAIN_MAX: %lu\n", STR_CHAIN_MAX); + fprintf(output_fp, "STR_CHAIN_MAX: %lu\n", (unsigned long) STR_CHAIN_MAX); indent(indent_level); fprintf(output_fp, "array_size: %lu\n", (unsigned long) symbol->array_size); indent(indent_level); -- cgit v1.2.3