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-3586-g0678c0


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-3586-g0678c08
Date: Sun, 6 Jan 2019 09:16:39 -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, master has been updated
       via  0678c088360752f332752c3eaec551280151c29c (commit)
      from  6a41af4e0169f81386922d6a6065a8b408b77296 (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=0678c088360752f332752c3eaec551280151c29c

commit 0678c088360752f332752c3eaec551280151c29c
Author: Andrew J. Schorr <address@hidden>
Date:   Sun Jan 6 09:16:07 2019 -0500

    Remove alength array method in favor of accessing table_size directly.

diff --git a/ChangeLog b/ChangeLog
index 9a22e9c..e713dd4 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2019-01-06         Andrew J. Schorr      <address@hidden>
+
+       Remove pointless alength macro/method that uses a needless
+       function call indirection to access the table_size value.
+
+       * awk.h (alength, alength_ind): Remove these defines, and also renumber
+       the array_funcs items after that, and use the <blah>_ind define to
+       define <blah> instead of repeating the hardcoded numeric value.
+       (NUM_AFUNCS): Remove unused define.
+       (assoc_length): Redefine to access table_size directly.
+       (null_length): Remove prototype.
+       * array.c (null_array_func): Remove null_length entry.
+       (null_length): Remove obsolete function.
+       * cint_array.c (cint_array_func): Remove null_length entry.
+       * int_array.c (int_array_func): Remove null_length entry.
+       * str_array.c (str_array_func, env_array_func): Remove null_length
+       entry.
+       * gawkapi.c (api_flatten_array_typed): Use the assoc_empty macro to
+       check for an empty array instead of comparing table_size to 0.
+       * symbol.c (lookup, check_param_names): Ditto.
+
 2018-12-21         Arnold D. Robbins     <address@hidden>
 
        * configure.ac: Remove -O only if .developing has 'debug' in it.
diff --git a/array.c b/array.c
index aa52f3a..d8fbab3 100644
--- a/array.c
+++ b/array.c
@@ -40,7 +40,6 @@ static NODE **null_dump(NODE *symbol, NODE *subs);
 static afunc_t null_array_func[] = {
        (afunc_t) 0,
        (afunc_t) 0,
-       null_length,
        null_lookup,
        null_afunc,
        null_afunc,
@@ -150,15 +149,6 @@ null_lookup(NODE *symbol, NODE *subs)
        return symbol->alookup(symbol, subs);
 }
 
-/* null_length --- default function for array length interface */
-
-NODE **
-null_length(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED)
-{
-       static NODE *tmp;
-       tmp = symbol;
-       return & tmp;
-}
 
 /* null_afunc --- default function for array interface */
 
diff --git a/awk.h b/awk.h
index 6f0f516..cb98491 100644
--- a/awk.h
+++ b/awk.h
@@ -540,29 +540,26 @@ typedef struct exp_node {
 #define xarray         sub.nodep.rn
 #define parent_array   sub.nodep.x.extra
 
-#define ainit          array_funcs[0]
 #define ainit_ind      0
-#define atypeof                array_funcs[1]
+#define ainit          array_funcs[ainit_ind]
 #define atypeof_ind    1
-#define alength                array_funcs[2]
-#define alength_ind    2
-#define alookup        array_funcs[3]
-#define alookup_ind    3
-#define aexists        array_funcs[4]
-#define aexists_ind    4
-#define aclear         array_funcs[5]
-#define aclear_ind     5
-#define aremove                array_funcs[6]
-#define aremove_ind    6
-#define alist          array_funcs[7]
-#define alist_ind      7
-#define acopy          array_funcs[8]
-#define acopy_ind      8
-#define adump          array_funcs[9]
-#define adump_ind      9
-#define astore         array_funcs[10]
-#define astore_ind     10
-#define NUM_AFUNCS     11              /* # of entries in array_funcs */
+#define atypeof                array_funcs[atypeof_ind]
+#define alookup_ind    2
+#define alookup        array_funcs[alookup_ind]
+#define aexists_ind    3
+#define aexists        array_funcs[aexists_ind]
+#define aclear_ind     4
+#define aclear         array_funcs[aclear_ind]
+#define aremove_ind    5
+#define aremove                array_funcs[aremove_ind]
+#define alist_ind      6
+#define alist          array_funcs[alist_ind]
+#define acopy_ind      7
+#define acopy          array_funcs[acopy_ind]
+#define adump_ind      8
+#define adump          array_funcs[adump_ind]
+#define astore_ind     9
+#define astore         array_funcs[astore_ind]
 
 /* Node_array_ref: */
 #define orig_array lnode
@@ -1343,7 +1340,7 @@ DEREF(NODE *r)
 extern jmp_buf fatal_tag;
 extern int fatal_tag_valid;
 
-#define assoc_length(a)        ((*((a)->alength(a, NULL)))->table_size)
+#define assoc_length(a)        ((a)->table_size)
 #define assoc_empty(a) (assoc_length(a) == 0)
 #define assoc_lookup(a, s)     ((a)->alookup(a, s))
 
@@ -1376,7 +1373,6 @@ extern const char *make_aname(const NODE *symbol);
 extern const char *array_vname(const NODE *symbol);
 extern void array_init(void);
 extern int register_array_func(afunc_t *afunc);
-extern NODE **null_length(NODE *symbol, NODE *subs);
 extern NODE **null_afunc(NODE *symbol, NODE *subs);
 extern void set_SUBSEP(void);
 extern NODE *concat_exp(int nargs, bool do_subsep);
diff --git a/cint_array.c b/cint_array.c
index 05b9440..7db45fd 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -62,7 +62,6 @@ static void cint_print(NODE *symbol);
 afunc_t cint_array_func[] = {
        cint_array_init,
        is_uinteger,
-       null_length,
        cint_lookup,
        cint_exists,
        cint_clear,
diff --git a/gawkapi.c b/gawkapi.c
index 7b1445c..037ca43 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -1179,7 +1179,7 @@ api_flatten_array_typed(awk_ext_id_t id,
 
        if (   array == NULL
            || array->type != Node_var_array
-           || array->table_size == 0
+           || assoc_empty(array)
            || data == NULL)
                return awk_false;
 
diff --git a/int_array.c b/int_array.c
index 069e027..9f70517 100644
--- a/int_array.c
+++ b/int_array.c
@@ -49,7 +49,6 @@ static void grow_int_table(NODE *symbol);
 afunc_t int_array_func[] = {
        int_array_init,
        is_integer,
-       null_length,
        int_lookup,
        int_exists,
        int_clear,
diff --git a/str_array.c b/str_array.c
index bc6584d..4972a92 100644
--- a/str_array.c
+++ b/str_array.c
@@ -59,7 +59,6 @@ static NODE **str_dump(NODE *symbol, NODE *ndump);
 afunc_t str_array_func[] = {
        str_array_init,
        (afunc_t) 0,
-       null_length,
        str_lookup,
        str_exists,
        str_clear,
@@ -78,7 +77,6 @@ static NODE **env_clear(NODE *symbol, NODE *subs);
 afunc_t env_array_func[] = {
        str_array_init,
        (afunc_t) 0,
-       null_length,
        str_lookup,
        str_exists,
        env_clear,
diff --git a/symbol.c b/symbol.c
index 797b5ec..9f8af3a 100644
--- a/symbol.c
+++ b/symbol.c
@@ -106,7 +106,7 @@ lookup(const char *name)
 
        n = NULL;
        for (i = 0; tables[i] != NULL; i++) {
-               if (tables[i]->table_size == 0)
+               if (assoc_empty(tables[i]))
                        continue;
 
                if ((do_posix || do_traditional) && tables[i] == global_table)
@@ -644,7 +644,7 @@ check_param_names(void)
        bool result = true;
        NODE n;
 
-       if (func_table->table_size == 0)
+       if (assoc_empty(func_table))
                return result;
 
        max = func_table->table_size * 2;

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

Summary of changes:
 ChangeLog    | 21 +++++++++++++++++++++
 array.c      | 10 ----------
 awk.h        | 42 +++++++++++++++++++-----------------------
 cint_array.c |  1 -
 gawkapi.c    |  2 +-
 int_array.c  |  1 -
 str_array.c  |  2 --
 symbol.c     |  4 ++--
 8 files changed, 43 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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