aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 2421aea1..57411afc 100644
--- a/eval.c
+++ b/eval.c
@@ -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;