diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-01-18 23:12:12 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-01-18 23:12:12 +0200 |
commit | afba5217277b6dc0ef7cbd5ab401f8b31efebde5 (patch) | |
tree | 8f43b64f93736ead1698b126768f1191e3c10acf | |
parent | 93946258bb36671b98761689667b4e16845bd887 (diff) | |
parent | f7d8956c4fd8324667060933c2c30112e6c80507 (diff) | |
download | egawk-afba5217277b6dc0ef7cbd5ab401f8b31efebde5.tar.gz egawk-afba5217277b6dc0ef7cbd5ab401f8b31efebde5.tar.bz2 egawk-afba5217277b6dc0ef7cbd5ab401f8b31efebde5.zip |
Merge branch 'master' into feature/api-mpfr
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | interpret.h | 11 |
2 files changed, 13 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2017-01-18 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (r_interpret): Increase robustness of the optimization + logic in Op_assign_concat -- check that the node has MALLOC set, + and make sure to wipe all flags other than MALLOC, STRING, STRCUR, + and possibly WSTRCUR. Use STFMT_UNUSED define. + 2017-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com> * interpret.h (r_interpret): Fix bug in Op_assign_concat reported diff --git a/interpret.h b/interpret.h index 3526325e..9661910a 100644 --- a/interpret.h +++ b/interpret.h @@ -718,16 +718,18 @@ mod: *lhs = dupnode(t1); } - if (t1 != t2 && t1->valref == 1 && (t1->flags & (MPFN|MPZN)) == 0) { + if (t1 != t2 && t1->valref == 1 && (t1->flags & (MALLOC|MPFN|MPZN)) == MALLOC) { size_t nlen = t1->stlen + t2->stlen; erealloc(t1->stptr, char *, nlen + 1, "r_interpret"); memcpy(t1->stptr + t1->stlen, t2->stptr, t2->stlen); t1->stlen = nlen; t1->stptr[nlen] = '\0'; - t1->flags &= ~(NUMCUR|NUMBER|USER_INPUT|NUMINT|INTIND); - t1->flags |= (STRING|STRCUR); - t1->stfmt = -1; + /* clear flags except WSTRCUR (used below) */ + t1->flags &= WSTRCUR; + /* configure as a string as in make_str_node */ + t1->flags |= (MALLOC|STRING|STRCUR); + t1->stfmt = STFMT_UNUSED; if ((t1->flags & WSTRCUR) != 0 && (t2->flags & WSTRCUR) != 0) { size_t wlen = t1->wstlen + t2->wstlen; @@ -737,7 +739,6 @@ mod: memcpy(t1->wstptr + t1->wstlen, t2->wstptr, t2->wstlen * sizeof(wchar_t)); t1->wstlen = wlen; t1->wstptr[wlen] = L'\0'; - t1->flags |= WSTRCUR; } else free_wstr(*lhs); } else { |