gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, feature/andy, updated. gawk-4.1.0-2362-g


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, feature/andy, updated. gawk-4.1.0-2362-g4a20341
Date: Sun, 4 Dec 2016 21:38:39 +0000 (UTC)

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/andy has been updated
       via  4a20341b487c17b49fc455ba37df84946eda38a7 (commit)
      from  2b9a30b2ab91ea465a649be0fd0927c2aebc67ff (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=4a20341b487c17b49fc455ba37df84946eda38a7

commit 4a20341b487c17b49fc455ba37df84946eda38a7
Author: Andrew J. Schorr <address@hidden>
Date:   Sun Dec 4 16:38:16 2016 -0500

    Minor fixes to fixtype and do_typeof.

diff --git a/ChangeLog b/ChangeLog
index 6a0d300..b987dc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2016-12-04         Andrew J. Schorr     <address@hidden>
 
+       * awk.h (fixtype): Remove conditional checking if the node type
+       is Node_val. This is already covered by the assert, and if it's not
+       true, we have serious bugs.
+       * builtin.c (do_typeof): Do not treat Node_var the same way as
+       Node_val, since they are different beasts. In reality, the argument
+       to this function will never have type Node_var.
+
+2016-12-04         Andrew J. Schorr     <address@hidden>
+
        * gawkapi.h (awk_element_t): Remove obsolete comment claiming that
        the index will always be a string.
        (gawk_api_t): Add new api_flatten_array_typed function and indicate
diff --git a/awk.h b/awk.h
index 0cf0627..4359593 100644
--- a/awk.h
+++ b/awk.h
@@ -1882,12 +1882,10 @@ static inline NODE *
 fixtype(NODE *n)
 {
        assert(n->type == Node_val);
-       if (n->type == Node_val) {
-               if ((n->flags & (NUMCUR|USER_INPUT)) == USER_INPUT)
-                       return force_number(n);
-               if ((n->flags & INTIND) != 0)
-                       return force_string(n);
-       }
+       if ((n->flags & (NUMCUR|USER_INPUT)) == USER_INPUT)
+               return force_number(n);
+       if ((n->flags & INTIND) != 0)
+               return force_string(n);
        return n;
 }
 
diff --git a/builtin.c b/builtin.c
index 5d7c376..f71d71d 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3988,7 +3988,6 @@ do_typeof(int nargs)
                deref = false;
                break;
        case Node_val:
-       case Node_var:
                switch (fixtype(arg)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) 
{
                case STRING:
                        res = "string";
@@ -4017,6 +4016,14 @@ do_typeof(int nargs)
                res = "untyped";
                deref = false;
                break;
+       case Node_var:
+               /*
+                * Note: this doesn't happen because the function calling code
+                * in interpret.h pushes Node_var->var_value.
+                */
+               fatal(_("typeof: invalid argument type `%s'"),
+                               nodetype2str(arg->type));
+               break;
        default:
                fatal(_("typeof: unknown argument type `%s'"),
                                nodetype2str(arg->type));

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

Summary of changes:
 ChangeLog |    9 +++++++++
 awk.h     |   10 ++++------
 builtin.c |    9 ++++++++-
 3 files changed, 21 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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