aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim van der Molen <58601421+tbvdm@users.noreply.github.com>2020-07-02 20:21:10 +0200
committerGitHub <noreply@github.com>2020-07-02 21:21:10 +0300
commitcc19af1308fadaad9ff1611155c666cd48cfe32b (patch)
treee7ba53af9c91ba4f51fa05309427e7a98f64b779
parentf232de85f6787967552cd3efe79fc0b4f152d090 (diff)
downloadone-true-awk-cc19af1308fadaad9ff1611155c666cd48cfe32b.tar.gz
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 <tim@kariliq.nl>
-rw-r--r--run.c6
1 files 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';