diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-08 15:26:00 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-08 15:26:00 -0400 |
commit | c86137f472fdf876c2c223c8d99f673f477b7554 (patch) | |
tree | 7ed0e172eaa8d4f831a2d59287547f63f1e71dee /mpfr.c | |
parent | 4a0f74139fb702a14c2e6782fb1965245e4f9d2f (diff) | |
download | egawk-c86137f472fdf876c2c223c8d99f673f477b7554.tar.gz egawk-c86137f472fdf876c2c223c8d99f673f477b7554.tar.bz2 egawk-c86137f472fdf876c2c223c8d99f673f477b7554.zip |
Optimization: support unterminated field strings inside gawk, but make terminated copies for the API.
Diffstat (limited to 'mpfr.c')
-rw-r--r-- | mpfr.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -275,6 +275,7 @@ static int force_mpnum(NODE *n, int do_nondec, int use_locale) { char *cp, *cpend, *ptr, *cp1; + char save; int tval, base = 10; if (n->stlen == 0) { @@ -291,6 +292,9 @@ force_mpnum(NODE *n, int do_nondec, int use_locale) return false; } + save = *cpend; + *cpend = '\0'; + if (*cp == '+' || *cp == '-') cp1 = cp + 1; else @@ -325,6 +329,7 @@ done: /* trailing space is OK for NUMBER */ while (ptr < cpend && isspace((unsigned char) *ptr)) ptr++; + *cpend = save; if (errno == 0 && ptr == cpend) return true; errno = 0; |