diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-04-27 22:51:54 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-04-27 22:51:54 +0300 |
commit | 04746bc5c0301fac55badc956225f486607dffd9 (patch) | |
tree | bcf5a6644265574c59d2f47129009770ed4bab59 /node.c | |
parent | 9e2c7a30a0dfa4f50ea4c052d18f9a923bb51b87 (diff) | |
download | egawk-04746bc5c0301fac55badc956225f486607dffd9.tar.gz egawk-04746bc5c0301fac55badc956225f486607dffd9.tar.bz2 egawk-04746bc5c0301fac55badc956225f486607dffd9.zip |
Code cleanups in array.c and side effects in other files.
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -278,6 +278,11 @@ dupnode(NODE *n) { NODE *r; + if (n->type == Node_ahash) { + n->ahname_ref++; + return n; + } + assert(n->type == Node_val); if ((n->flags & PERM) != 0) @@ -452,6 +457,16 @@ unref(NODE *tmp) if ((tmp->flags & PERM) != 0) return; + if (tmp->type == Node_ahash) { + if (tmp->ahname_ref > 1) + tmp->ahname_ref--; + else { + efree(tmp->ahname_str); + freenode(tmp); + } + return; + } + if ((tmp->flags & MALLOC) != 0) { if (tmp->valref > 1) { tmp->valref--; |