summaryrefslogtreecommitdiff
path: root/interpret.h
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-07-08 15:26:00 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-07-08 15:26:00 -0400
commitc86137f472fdf876c2c223c8d99f673f477b7554 (patch)
tree7ed0e172eaa8d4f831a2d59287547f63f1e71dee /interpret.h
parent4a0f74139fb702a14c2e6782fb1965245e4f9d2f (diff)
downloadgawk-c86137f472fdf876c2c223c8d99f673f477b7554.tar.gz
Optimization: support unterminated field strings inside gawk, but make terminated copies for the API.
Diffstat (limited to 'interpret.h')
-rw-r--r--interpret.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/interpret.h b/interpret.h
index 9d7b423e..7d13f7f8 100644
--- a/interpret.h
+++ b/interpret.h
@@ -135,10 +135,13 @@ top:
case Op_push_i:
m = pc->memory;
if (! do_traditional && (m->flags & INTLSTR) != 0) {
- char *orig, *trans;
+ char *orig, *trans, save;
+ save = m->stptr[m->stlen];
+ m->stptr[m->stlen] = '\0';
orig = m->stptr;
trans = dgettext(TEXTDOMAIN, orig);
+ m->stptr[m->stlen] = save;
m = make_string(trans, strlen(trans));
} else
UPREF(m);
@@ -959,6 +962,7 @@ arrayfor:
if (t1->type == Node_val)
DEREF(t1);
}
+ free_api_string_copies();
PUSH(r);
}
break;