diff options
-rw-r--r-- | TODO.xgawk | 2 | ||||
-rw-r--r-- | extension/ChangeLog | 5 | ||||
-rw-r--r-- | extension/filefuncs.c | 7 |
3 files changed, 12 insertions, 2 deletions
@@ -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 df493227..a3526863 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,5 +1,10 @@ 2012-05-13 Andrew J. Schorr <aschorr@telemetry-investments.com> + * 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 <aschorr@telemetry-investments.com> + * xreadlink.[ch]: Remove unused files. 2012-05-11 Arnold D. Robbins <arnold@skeeve.com> diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 9758ba8e..01f3fce2 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; } |