Simplify expression in makeline()
This expression was wrong, but it was causing a false positive in some compilers that couldn't see that error() cannot return. The actual problem of the line is that it was too complex and it is better to split it in simplex expressions.
This commit is contained in:
parent
18f6c5e014
commit
f45156d5b4
6
ed.c
6
ed.c
|
@ -192,8 +192,10 @@ makeline(char *s, int *off)
|
|||
char c, *begin = s;
|
||||
|
||||
if (lastidx >= idxsize) {
|
||||
if (idxsize > SIZE_MAX - NUMLINES ||
|
||||
!(lp = realloc(zero, (idxsize + NUMLINES) * sizeof(*lp))))
|
||||
lp = NULL;
|
||||
if (idxsize <= SIZE_MAX - NUMLINES)
|
||||
lp = realloc(zero, (idxsize + NUMLINES) * sizeof(*lp));
|
||||
if (!lp)
|
||||
error("out of memory");
|
||||
idxsize += NUMLINES;
|
||||
zero = lp;
|
||||
|
|
Loading…
Reference in New Issue
Block a user