commit 6431c14bb25ce63732f326bd8791c8cc58cbb234
parent dcb15d26b930278fd5aee15468ffc6aab53e445a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 3 Dec 2015 11:19:34 +0100
Fix order of parameters in join()
addchar() expects char to add, pointer to string, capacity and
size, but capacity and size were swapped in all the calls in
join().
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ed.c b/ed.c
@@ -641,11 +641,11 @@ join(void)
free(s);
for (s = NULL, i = line1; i <= line2; i = nextln(i)) {
for (t = gettxt(i); (c = *t) != '\n'; ++t)
- s = addchar(*t, s, &len, &cap);
+ s = addchar(*t, s, &cap, &len);
}
- s = addchar('\n', s, &len, &cap);
- s = addchar('\0', s, &len, &cap);
+ s = addchar('\n', s, &cap, &len);
+ s = addchar('\0', s, &cap, &len);
delete(line1, line2);
inject(s);
free(s);