gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, extgawk, updated. 06323619397520aba2fc2f


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 06323619397520aba2fc2f8f983d67d06c6610fa
Date: Sun, 13 May 2012 20:40:46 +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, extgawk has been updated
       via  06323619397520aba2fc2f8f983d67d06c6610fa (commit)
      from  3d662631342d999b3c80952f2e8eca8b390bdd95 (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=06323619397520aba2fc2f8f983d67d06c6610fa

commit 06323619397520aba2fc2f8f983d67d06c6610fa
Author: Andrew J. Schorr <address@hidden>
Date:   Sun May 13 16:39:35 2012 -0400

    Add comment to extension/filefuncs.c discussing unref on value from 
assoc_lookup.

diff --git a/TODO.xgawk b/TODO.xgawk
index cf676c1..1917c73 100644
--- a/TODO.xgawk
+++ b/TODO.xgawk
@@ -36,8 +36,6 @@ To do (not necessarily in this order):
 
 - The -f flag should not eliminate duplicates.
 
-- Add comment about using unref on value returned from assoc_lookup.
-
 - Enable default ".awk" search in io.c:find_source().  The simple change
   is to add this code inline in io.c:
       #ifndef DEFAULT_FILETYPE
diff --git a/extension/ChangeLog b/extension/ChangeLog
index df49322..a352686 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,5 +1,10 @@
 2012-05-13         Andrew J. Schorr     <address@hidden>
 
+       * filefuncs.c (array_set): Add a comment discussing the use of unref
+       on the value returned by assoc_lookup.
+
+2012-05-13         Andrew J. Schorr     <address@hidden>
+
        * xreadlink.[ch]: Remove unused files.
 
 2012-05-11         Arnold D. Robbins     <address@hidden>
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 9758ba8..01f3fce 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -220,6 +220,13 @@ array_set(NODE *array, const char *sub, NODE *value)
        tmp = make_string(sub, strlen(sub));
        aptr = assoc_lookup(array, tmp);
        unref(tmp);
+       /* 
+        * Note: since we initialized with assoc_clear, we know that aptr
+        * has been initialized with Nnull_string.  Thus, the call to
+        * unref(*aptr) is not strictly necessary.  However, I think it is
+        * generally more correct to call unref to maintain the proper
+        * reference count.
+        */
        unref(*aptr);
        *aptr = value;
 }

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

Summary of changes:
 TODO.xgawk            |    2 --
 extension/ChangeLog   |    5 +++++
 extension/filefuncs.c |    7 +++++++
 3 files changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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