76007242b5
* gawk-4.2.0-000-do-not-fold-constant-strings.patch added, to prevent some newly found regression: http://lists.gnu.org/archive/html/bug-gawk/2017-10/msg00033.html * enabled BuildRequires for bison because of patch above * gawk-4.2.0-001-rwarray-small-improvements.patch added
52 lines
1.6 KiB
Diff
52 lines
1.6 KiB
Diff
From 750e3168705de678474fea0a551f9cf29e9e077d Mon Sep 17 00:00:00 2001
|
|
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
|
Date: Sat, 28 Oct 2017 23:22:15 +0300
|
|
Subject: [PATCH] Small improvements in extension/rwarray.c.
|
|
|
|
---
|
|
extension/ChangeLog | 5 +++++
|
|
extension/rwarray.c | 6 ++++--
|
|
2 files changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/extension/ChangeLog b/extension/ChangeLog
|
|
index 4bfd896..c04e9c2 100644
|
|
--- a/extension/ChangeLog
|
|
+++ b/extension/ChangeLog
|
|
@@ -1,3 +1,8 @@
|
|
+2017-10-28 Arnold D. Robbins <arnold@skeeve.com>
|
|
+
|
|
+ * rwarray.c (do_writea): Fix description in comment.
|
|
+ (write_array): Free the flattened array if writing an element fails.
|
|
+
|
|
2017-10-19 Arnold D. Robbins <arnold@skeeve.com>
|
|
|
|
* 4.2.0: Release tar ball made.
|
|
diff --git a/extension/rwarray.c b/extension/rwarray.c
|
|
index 2e82ca7..997b6b2 100644
|
|
--- a/extension/rwarray.c
|
|
+++ b/extension/rwarray.c
|
|
@@ -114,7 +114,7 @@ do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused)
|
|
if (nargs < 2)
|
|
goto out;
|
|
|
|
- /* directory is first arg, array to dump is second */
|
|
+ /* filename is first arg, array to dump is second */
|
|
if (! get_argument(0, AWK_STRING, & filename)) {
|
|
fprintf(stderr, _("do_writea: argument 0 is not a string\n"));
|
|
errno = EINVAL;
|
|
@@ -178,8 +178,10 @@ write_array(FILE *fp, awk_array_t array)
|
|
return awk_false;
|
|
|
|
for (i = 0; i < flat_array->count; i++) {
|
|
- if (! write_elem(fp, & flat_array->elements[i]))
|
|
+ if (! write_elem(fp, & flat_array->elements[i])) {
|
|
+ (void) release_flattened_array(array, flat_array);
|
|
return awk_false;
|
|
+ }
|
|
}
|
|
|
|
if (! release_flattened_array(array, flat_array)) {
|
|
--
|
|
2.9.5
|
|
|