gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2555-ga3be85


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2555-ga3be85e
Date: Wed, 26 Apr 2017 11:34:58 -0400 (EDT)

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, master has been updated
       via  a3be85eec86d00c12e7f4b41a9e27794fbb479a6 (commit)
      from  8972aa34f007e12c3eb3270b79d39403d80a542f (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=a3be85eec86d00c12e7f4b41a9e27794fbb479a6

commit a3be85eec86d00c12e7f4b41a9e27794fbb479a6
Author: Andrew J. Schorr <address@hidden>
Date:   Wed Apr 26 11:32:18 2017 -0400

    Fix bug where Node_regex was setting valref, and restore valref to Node_val 
part of NODE union where it belongs.

diff --git a/ChangeLog b/ChangeLog
index eccda54..a2ab628 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-04-26         Andrew J. Schorr     <address@hidden>
+
+       * awkgram.y (make_regnode): Fix bug -- we should not set valref to 1
+       when creating a node of type Node_regex, since valref is appropriate
+       only for Node_val nodes. This fixes a bug introduced in commit
+       687e6594. Also, add an assert to make it clear that this function
+       supports only Node_regex and Node_dynregex.
+       * awk.h (NODE): Restore sref to the `val' subportion, since it is not
+       really needed for Node_regex, now that the bug in make_regnode has
+       been fixed.
+       (valref): Restore macro definition.
+
 2017-04-24         Arnold D. Robbins     <address@hidden>
 
        * awk.h (NODE): Additional cleanups. Removed `aq' and `param_list'
diff --git a/awk.h b/awk.h
index 2355246..ab84c58 100644
--- a/awk.h
+++ b/awk.h
@@ -374,6 +374,7 @@ typedef struct exp_node {
 #endif
                        char *sp;
                        size_t slen;
+                       long sref;
                        int idx;
                        wchar_t *wsp;
                        size_t wslen;
@@ -383,10 +384,6 @@ typedef struct exp_node {
        NODETYPE type;
        unsigned int flags;
 
-       // We access valref for both Node_val and Node_regex values,
-       // so it needs to be outside the union.
-       long valref;
-
 /* type = Node_val */
        /*
         * STRING and NUMBER are mutually exclusive, except for the special
@@ -494,6 +491,7 @@ typedef struct exp_node {
  */
 #define stptr  sub.val.sp
 #define stlen  sub.val.slen
+#define valref sub.val.sref
 #define stfmt  sub.val.idx
 #define wstptr sub.val.wsp
 #define wstlen sub.val.wslen
diff --git a/awkgram.c b/awkgram.c
index aa7b4a4..b73c6a3 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -7433,6 +7433,7 @@ make_regnode(int type, NODE *exp)
 {
        NODE *n;
 
+       assert(type == Node_regex || type == Node_dynregex);
        getnode(n);
        memset(n, 0, sizeof(NODE));
        n->type = type;
@@ -7452,7 +7453,6 @@ make_regnode(int type, NODE *exp)
                }
                n->re_exp = exp;
                n->re_flags = CONSTANT;
-               n->valref = 1;
        }
        return n;
 }
diff --git a/awkgram.y b/awkgram.y
index 6e4d6c3..2c1555b 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5013,6 +5013,7 @@ make_regnode(int type, NODE *exp)
 {
        NODE *n;
 
+       assert(type == Node_regex || type == Node_dynregex);
        getnode(n);
        memset(n, 0, sizeof(NODE));
        n->type = type;
@@ -5032,7 +5033,6 @@ make_regnode(int type, NODE *exp)
                }
                n->re_exp = exp;
                n->re_flags = CONSTANT;
-               n->valref = 1;
        }
        return n;
 }

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

Summary of changes:
 ChangeLog | 12 ++++++++++++
 awk.h     |  6 ++----
 awkgram.c |  2 +-
 awkgram.y |  2 +-
 4 files changed, 16 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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