aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-04-27 22:51:54 +0300
committerArnold D. Robbins <arnold@skeeve.com>2011-04-27 22:51:54 +0300
commit04746bc5c0301fac55badc956225f486607dffd9 (patch)
treebcf5a6644265574c59d2f47129009770ed4bab59 /node.c
parent9e2c7a30a0dfa4f50ea4c052d18f9a923bb51b87 (diff)
downloadegawk-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.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/node.c b/node.c
index 5fe8a6f5..24d2ca22 100644
--- a/node.c
+++ b/node.c
@@ -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--;