Fix type of c in getrhs()

C is compared against EOF, so it cannot be char.
This commit is contained in:
Roberto E. Vargas Caballero 2018-03-04 14:56:44 +01:00 committed by sin
parent 0732529fef
commit 77fe371fe4

21
ed.c
View File

@ -926,15 +926,14 @@ static void
getrhs(int delim) getrhs(int delim)
{ {
int c; int c;
size_t siz, cap; static String s;
static char *s;
free(s); free(s.str);
s = NULL; s.str = NULL;
siz = cap = 0; s.siz = s.cap = 0;
while ((c = input()) != '\n' && c != EOF && c != delim) while ((c = input()) != '\n' && c != EOF && c != delim)
s = addchar(c, s, &siz, &cap); addchar_(c, &s);
s = addchar('\0', s, &siz, &cap); addchar_('\0', &s);
if (c == EOF) if (c == EOF)
error("invalid pattern delimiter"); error("invalid pattern delimiter");
if (c == '\n') { if (c == '\n') {
@ -942,15 +941,15 @@ getrhs(int delim)
back(c); back(c);
} }
if (!strcmp("%", s)) { if (!strcmp("%", s.str)) {
free(s); free(s.str);
if (!rhs) if (!rhs)
error("no previous substitution"); error("no previous substitution");
} else { } else {
free(rhs); free(rhs);
rhs = s; rhs = s.str;
} }
s = NULL; s.str = NULL;
} }
static int static int