aboutsummaryrefslogtreecommitdiffstats
path: root/interpret.h
diff options
context:
space:
mode:
Diffstat (limited to 'interpret.h')
-rw-r--r--interpret.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/interpret.h b/interpret.h
index 0d1511ab..228a3f3e 100644
--- a/interpret.h
+++ b/interpret.h
@@ -670,8 +670,6 @@ mod:
t1 = force_string(*lhs);
t2 = POP_STRING();
- free_wstr(*lhs);
-
if (t1 != *lhs) {
unref(*lhs);
*lhs = dupnode(t1);
@@ -685,6 +683,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;