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. 76d9cad48102984af70a1b6


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. 76d9cad48102984af70a1b6a202abb966b75aa22
Date: Tue, 22 Jan 2013 18:37:14 +0000

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  76d9cad48102984af70a1b6a202abb966b75aa22 (commit)
      from  28d9143e9b98728450f5db7b2244f99768de399f (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=76d9cad48102984af70a1b6a202abb966b75aa22

commit 76d9cad48102984af70a1b6a202abb966b75aa22
Author: Arnold D. Robbins <address@hidden>
Date:   Tue Jan 22 20:36:43 2013 +0200

    Bug fix for -d with -i.

diff --git a/ChangeLog b/ChangeLog
index e98a0f4..9305e7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-22         Arnold D. Robbins     <address@hidden>
+
+       * symbol.c (get_symbols): Reset count after each loop to only
+       sort the actual items retrieved. Thanks to Manuel Collado (by
+       way of Andrew Schorr) for reporting the bug.  Also add some
+       commentary and fix function name in emalloc calls.
+
 2013-01-20         Arnold D. Robbins     <address@hidden>
 
        * re.c (regexflags2str): New routine.
diff --git a/symbol.c b/symbol.c
index 4ff9c78..c775c93 100644
--- a/symbol.c
+++ b/symbol.c
@@ -376,13 +376,20 @@ get_symbols(SYMBOL_TYPE what, int sort)
        long max;
        NODE *the_table;
 
+       /*
+        * assoc_list() returns an array with two elements per awk array
+        * element. Elements i and i+1 in the C array represent the key
+        * and value of element j in the awk array. Thus the loops use += 2
+        * to go through the awk array.
+        */
+
        if (what == FUNCTION) {
                count = func_count;
                the_table = func_table;
 
                max = the_table->table_size * 2;
                list = assoc_list(the_table, "@unsorted", ASORTI);
-               emalloc(table, NODE **, (count + 1) * sizeof(NODE *), 
"symbol_list");
+               emalloc(table, NODE **, (count + 1) * sizeof(NODE *), 
"get_symbols");
 
                for (i = j = 0; i < max; i += 2) {
                        r = list[i+1];
@@ -391,6 +398,7 @@ get_symbols(SYMBOL_TYPE what, int sort)
                        assert(r->type == Node_func);
                        table[j++] = r;
                }
+               count = j;
        } else {        /* what == VARIABLE */
                the_table = symbol_table;
                count = var_count;
@@ -399,7 +407,7 @@ get_symbols(SYMBOL_TYPE what, int sort)
 
                max = the_table->table_size * 2;
                list = assoc_list(the_table, "@unsorted", ASORTI);
-               emalloc(table, NODE **, (count + 1) * sizeof(NODE *), 
"symbol_list");
+               emalloc(table, NODE **, (count + 1) * sizeof(NODE *), 
"get_symbols");
 
                for (i = j = 0; i < max; i += 2) {
                        r = list[i+1];
@@ -407,6 +415,7 @@ get_symbols(SYMBOL_TYPE what, int sort)
                                continue;
                        table[j++] = r;
                }
+               count = j;
        }
 
        efree(list);

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

Summary of changes:
 ChangeLog |    7 +++++++
 symbol.c  |   13 +++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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