From cc19af1308fadaad9ff1611155c666cd48cfe32b Mon Sep 17 00:00:00 2001 From: Tim van der Molen <58601421+tbvdm@users.noreply.github.com> Date: Thu, 2 Jul 2020 20:21:10 +0200 Subject: [PATCH] Fix concatenation regression (#85) The optimization in commit 1d6ddfd9c0ed7119c0601474cded3a385068e886 reintroduced the regression that was fixed in commit e26237434fb769d9c1ea239101eb5b24be588eea. Co-authored-by: Tim van der Molen --- run.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/run.c b/run.c index 4adacb3..9aff663 100644 --- a/run.c +++ b/run.c @@ -1192,12 +1192,12 @@ Cell *cat(Node **a, int q) /* a[0] cat a[1] */ x = execute(a[0]); n1 = strlen(getsval(x)); + adjbuf(&s, &ssz, n1, recsize, 0, "cat1"); + memcpy(s, x->sval, n1); y = execute(a[1]); n2 = strlen(getsval(y)); - - adjbuf(&s, &ssz, n1 + n2 + 1, recsize, 0, "cat"); - memcpy(s, x->sval, n1); + adjbuf(&s, &ssz, n1 + n2 + 1, recsize, 0, "cat2"); memcpy(s + n1, y->sval, n2); s[n1 + n2] = '\0';