diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-05 16:49:05 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-05 16:49:05 -0400 |
commit | f421a5fbef014040712a7c89e8863c7196f6ab93 (patch) | |
tree | 22a9544211a974bf155e5971d33c89a9796b93a5 /interpret.h | |
parent | cedd0829b0075533986fce1e699bc6ae511a891e (diff) | |
download | gawk-f421a5fbef014040712a7c89e8863c7196f6ab93.tar.gz |
Remove FIELD flag, since it is the inverse of the MALLOC flag.
Diffstat (limited to 'interpret.h')
-rw-r--r-- | interpret.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/interpret.h b/interpret.h index 3bb4532e..bbddd5a7 100644 --- a/interpret.h +++ b/interpret.h @@ -23,13 +23,19 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +/* + * If "r" is a field, valref should normally be > 1, because the field is + * created initially with valref 1, and valref should be bumped when it is + * pushed onto the stack by Op_field_spec. On the other hand, if we are + * assigning to $n, then Op_store_field calls unref(*lhs) before assigning + * the new value, so that decrements valref. So if the RHS is a field with + * valref 1, that effectively means that this is an assignment like "$n = $n", + * so a no-op, other than triggering $0 reconstitution. + */ #define UNFIELD(l, r) \ { \ /* if was a field, turn it into a var */ \ - if ((r->flags & FIELD) == 0) { \ - l = r; \ - } else if (r->valref == 1) { \ - r->flags &= ~FIELD; \ + if ((r->flags & MALLOC) != 0 || r->valref == 1) { \ l = r; \ } else { \ l = dupnode(r); \ |