Fix concatenation regression (#85)

The optimization in commit 1d6ddfd9c0
reintroduced the regression that was fixed in commit
e26237434f.

Co-authored-by: Tim van der Molen <tim@kariliq.nl>
This commit is contained in:
Tim van der Molen 2020-07-02 20:21:10 +02:00 committed by GitHub
parent f232de85f6
commit cc19af1308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

6
run.c
View File

@ -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';