diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | eval.c | 16 |
2 files changed, 22 insertions, 2 deletions
@@ -1,3 +1,11 @@ +2012-12-01 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (r_interpret): 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-10 Arnold D. Robbins <arnold@skeeve.com> * Update to bison 2.6.5. Various files regenerated. @@ -2160,14 +2160,26 @@ post: t1 = force_string(*lhs); t2 = POP_STRING(); - free_wstr(*lhs); - if (t1 != t2 && t1->valref == 1 && (t1->flags & PERM) == 0) { size_t nlen = t1->stlen + t2->stlen; erealloc(t1->stptr, char *, nlen + 2, "r_interpret"); memcpy(t1->stptr + t1->stlen, t2->stptr, t2->stlen); t1->stlen = nlen; t1->stptr[nlen] = '\0'; + +#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; |