Introduction
Introduction Statistics Contact Development Disclaimer Help
ed: Fix makeline - sbase - suckless unix tools
git clone git://git.suckless.org/sbase
Log
Files
Refs
README
LICENSE
---
commit 54a0fc3ecc34511bcba021bfedac10d965a3efe7
parent 09dc00f9951a5e8b07eb79f0cf6e090d6ef9532d
Author: Roberto E. Vargas Caballero <[email protected]>
Date: Mon, 27 Nov 2023 08:32:24 +0100
ed: Fix makeline
Strings without newlines created problems in the function
and the global field was not updated, making that new lines
added were marked as global being processed in the current
global command.
Diffstat:
M ed.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/ed.c b/ed.c
@@ -185,19 +185,20 @@ makeline(char *s, int *off)
if (lastidx >= idxsize) {
lp = NULL;
if (idxsize <= SIZE_MAX - NUMLINES)
- lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp));
+ lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp…
if (!lp)
error("out of memory");
idxsize += NUMLINES;
zero = lp;
}
lp = zero + lastidx;
+ lp->global = 0;
if (!s) {
lp->seek = -1;
len = 0;
} else {
- while ((c = *s++) != '\n')
+ while ((c = *s++) && c != '\n')
/* nothing */;
len = s - begin;
if ((lp->seek = lseek(scratch, 0, SEEK_END)) < 0 ||
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.