diff options
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--; |