aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-08-18 14:34:03 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-08-18 14:34:03 +0300
commitb723f14ac83c52de73771a97b0b84d97cc640fd0 (patch)
tree42cc7ef50ec15f99d1d0b2f8c573a318cf599c30 /field.c
parent28462b12ebc714843113ba497b7951d010b52485 (diff)
parentd9ca11d809e13dfab2c41ef51eb5007c05bb3987 (diff)
downloadegawk-b723f14ac83c52de73771a97b0b84d97cc640fd0.tar.gz
egawk-b723f14ac83c52de73771a97b0b84d97cc640fd0.tar.bz2
egawk-b723f14ac83c52de73771a97b0b84d97cc640fd0.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'field.c')
-rw-r--r--field.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/field.c b/field.c
index 3e29ec21..0685e9b5 100644
--- a/field.c
+++ b/field.c
@@ -217,20 +217,16 @@ rebuild_record()
*n = *r;
if (r->valref > 1) {
/*
- * This probably never happens, since it
- * was not considered by previous versions of
- * this function. But it seems clear that
+ * This can and does happen. It seems clear that
* we can't leave r's stptr pointing into the
* old $0 buffer that we are about to unref.
- * It's not a priori obvious that valref must be
- * 1 in all cases, so it seems wise to suppport
- * this corner case. The only question is
- * whether to add a warning message.
*/
emalloc(r->stptr, char *, r->stlen + 1, "rebuild_record");
memcpy(r->stptr, cops, r->stlen);
r->stptr[r->stlen] = '\0';
r->flags |= MALLOC;
+
+ n->valref = 1; // reset in the new field to start it off correctly!
}
n->stptr = cops;