diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-01 22:06:37 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-01 22:06:37 +0200 |
commit | 79796c4b5882e559a6a5f5453e47f8936df6a397 (patch) | |
tree | 98fe5543a63cce64387bf2e9530cde1ccfd153f1 | |
parent | 242ee720a6387f87e05d3eb8e30d2c7061cbf8ef (diff) | |
parent | 787d93719e61e44aa1ab66c8ecca9cd6ff4fddbf (diff) | |
download | egawk-79796c4b5882e559a6a5f5453e47f8936df6a397.tar.gz egawk-79796c4b5882e559a6a5f5453e47f8936df6a397.tar.bz2 egawk-79796c4b5882e559a6a5f5453e47f8936df6a397.zip |
Merge branch 'gawk-4.0-stable'
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | interpret.h | 16 |
2 files changed, 22 insertions, 2 deletions
@@ -1,3 +1,11 @@ +2012-12-01 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h: For op_assign_concat, if both strings + have WSTRCUR, then do the realloc() and append for the + wide string too. Thanks to Janis Papanagnou + <janis_papanagnou@hotmail.com> for the discussion in + comp.lang.awk. + 2012-11-30 Arnold D. Robbins <arnold@skeeve.com> * regcomp.c, regex.c, regex_internal.h, regexec.c: Sync diff --git a/interpret.h b/interpret.h index 26725a21..21cd9a80 100644 --- a/interpret.h +++ b/interpret.h @@ -622,8 +622,6 @@ mod: t1 = force_string(*lhs); t2 = POP_STRING(); - free_wstr(*lhs); - if (t1 != *lhs) { unref(*lhs); *lhs = dupnode(t1); @@ -637,6 +635,20 @@ mod: t1->stlen = nlen; t1->stptr[nlen] = '\0'; t1->flags &= ~(NUMCUR|NUMBER|NUMINT); + +#if MBS_SUPPORT + if ((t1->flags & WSTRCUR) != 0 && (t2->flags & WSTRCUR) != 0) { + size_t wlen = t1->wstlen + t2->wstlen; + + erealloc(t1->wstptr, wchar_t *, + sizeof(wchar_t) * (wlen + 2), "r_interpret"); + memcpy(t1->wstptr + t1->wstlen, t2->wstptr, t2->wstlen); + t1->wstlen = wlen; + t1->wstptr[wlen] = L'\0'; + t1->flags |= WSTRCUR; + } else + free_wstr(*lhs); +#endif } else { size_t nlen = t1->stlen + t2->stlen; char *p; |