- rel 2; upstream fixes used in fc
[packages/gawk.git] / gawk-4.2.0-001-rwarray-small-improvements.patch
1 From 750e3168705de678474fea0a551f9cf29e9e077d Mon Sep 17 00:00:00 2001
2 From: "Arnold D. Robbins" <arnold@skeeve.com>
3 Date: Sat, 28 Oct 2017 23:22:15 +0300
4 Subject: [PATCH] Small improvements in extension/rwarray.c.
5
6 ---
7  extension/ChangeLog | 5 +++++
8  extension/rwarray.c | 6 ++++--
9  2 files changed, 9 insertions(+), 2 deletions(-)
10
11 diff --git a/extension/ChangeLog b/extension/ChangeLog
12 index 4bfd896..c04e9c2 100644
13 --- a/extension/ChangeLog
14 +++ b/extension/ChangeLog
15 @@ -1,3 +1,8 @@
16 +2017-10-28         Arnold D. Robbins     <arnold@skeeve.com>
17 +
18 +       * rwarray.c (do_writea): Fix description in comment.
19 +       (write_array): Free the flattened array if writing an element fails.
20 +
21  2017-10-19         Arnold D. Robbins     <arnold@skeeve.com>
22  
23         * 4.2.0: Release tar ball made.
24 diff --git a/extension/rwarray.c b/extension/rwarray.c
25 index 2e82ca7..997b6b2 100644
26 --- a/extension/rwarray.c
27 +++ b/extension/rwarray.c
28 @@ -114,7 +114,7 @@ do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused)
29         if (nargs < 2)
30                 goto out;
31  
32 -       /* directory is first arg, array to dump is second */
33 +       /* filename is first arg, array to dump is second */
34         if (! get_argument(0, AWK_STRING, & filename)) {
35                 fprintf(stderr, _("do_writea: argument 0 is not a string\n"));
36                 errno = EINVAL;
37 @@ -178,8 +178,10 @@ write_array(FILE *fp, awk_array_t array)
38                 return awk_false;
39  
40         for (i = 0; i < flat_array->count; i++) {
41 -               if (! write_elem(fp, & flat_array->elements[i]))
42 +               if (! write_elem(fp, & flat_array->elements[i])) {
43 +                       (void) release_flattened_array(array, flat_array);
44                         return awk_false;
45 +               }
46         }
47  
48         if (! release_flattened_array(array, flat_array)) {
49 -- 
50 2.9.5
51
This page took 0.042008 seconds and 3 git commands to generate.