gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, feature/assoc_set, updated. gawk-4.1.0-3


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, feature/assoc_set, updated. gawk-4.1.0-3609-g5766636
Date: Sun, 20 Jan 2019 14:42:50 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, feature/assoc_set has been updated
       via  5766636f7bb7eb6d8fa9fd1b097ca74329062173 (commit)
      from  7560c312229e5967ff1b479b8ced6d3e8e99dc37 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5766636f7bb7eb6d8fa9fd1b097ca74329062173

commit 5766636f7bb7eb6d8fa9fd1b097ca74329062173
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Jan 20 21:42:36 2019 +0200

    Cleanups for assoc_set.

diff --git a/ChangeLog b/ChangeLog
index d7d1471..5e3f9a2 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-20         Arnold D. Robbins     <address@hidden>
+
+       * debug.c (do_set_var): Add comments before calls to assoc_set.
+       * interpret.h (r_interpret): For Op_sub_array, deref the subscript
+       appropriately. Thanks to Andy Schorr for the catch.
+
 2019-01-15         Arnold D. Robbins     <address@hidden>
 
        * array.c (asort_actual): Use assoc_set in 2 places.
diff --git a/debug.c b/debug.c
index f36a327..05083a4 100644
--- a/debug.c
+++ b/debug.c
@@ -1270,6 +1270,8 @@ do_set_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
                                        arg = arg->next;
                                        val = arg->a_node;
                                        newval = dupnode(val);
+                                       // subs should not be freed, so
+                                       // use dupnode in call to assoc_set.
                                        assoc_set(r, dupnode(subs), newval);
                                        fprintf(out_fp, "%s[\"%.*s\"] = ", 
name, (int) subs->stlen, subs->stptr);
                                        valinfo(newval, fprintf, out_fp);
@@ -1280,6 +1282,8 @@ do_set_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
                                        array = make_array();
                                        array->vname = estrdup(subs->stptr, 
subs->stlen);
                                        array->parent_array = r;
+                                       // subs should not be freed, so
+                                       // use dupnode in call to assoc_set.
                                        assoc_set(r, dupnode(subs), array);
                                        r = array;
                                } else if (value->type != Node_var_array) {
diff --git a/interpret.h b/interpret.h
index 53abadc..e989667 100644
--- a/interpret.h
+++ b/interpret.h
@@ -310,7 +310,8 @@ uninitialized_scalar:
                                t2 = force_string(t2);
                                fatal(_("attempt to use scalar `%s[\"%.*s\"]' 
as an array"),
                                                array_vname(t1), (int) 
t2->stlen, t2->stptr);
-                       }
+                       } else
+                               DEREF(t2);
 
                        PUSH(r);
                        break;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog   | 6 ++++++
 debug.c     | 4 ++++
 interpret.h | 3 ++-
 3 files changed, 12 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]