diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-01-18 23:12:20 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-01-18 23:12:20 +0200 |
commit | 40ecf95c1ce83fae380623f24afad017ac4816cc (patch) | |
tree | 767941f54c3a3f991a338b5141b473d2952bbb27 | |
parent | 779fea594a8823c53b3600fa98f75ed9e660b879 (diff) | |
parent | f7d8956c4fd8324667060933c2c30112e6c80507 (diff) | |
download | egawk-40ecf95c1ce83fae380623f24afad017ac4816cc.tar.gz egawk-40ecf95c1ce83fae380623f24afad017ac4816cc.tar.bz2 egawk-40ecf95c1ce83fae380623f24afad017ac4816cc.zip |
Merge branch 'master' into feature/fix-comments
-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 { |