patch: cleanup variable initialization a bit.

musl libc fgetln is a bit more pickier.

Hinted by:	chimera-linux (git 31491e1de2e1241885984cd9e4b978965f14eda4)
This commit is contained in:
Pedro F. Giffuni 2021-07-22 14:09:17 -05:00
parent 4a23504908
commit c384a27805
2 changed files with 4 additions and 2 deletions

View File

@ -284,7 +284,7 @@ static void
plan_b(const char *filename)
{
FILE *ifp;
size_t i = 0, j, len, maxlen = 1;
size_t i, j, len, maxlen;
char *lbuf = NULL, *p;
bool found_revision = (revision == NULL);
@ -294,6 +294,8 @@ plan_b(const char *filename)
unlink(TMPINNAME);
if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) < 0)
pfatal("can't open file %s", TMPINNAME);
len = 0;
maxlen = 1;
while ((p = fgetln(ifp, &len)) != NULL) {
if (p[len - 1] == '\n')
p[len - 1] = '\0';

View File

@ -1215,7 +1215,7 @@ size_t
pgets(bool do_indent)
{
char *line;
size_t len;
size_t len = 0;
int indent = 0, skipped = 0;
line = fgetln(pfp, &len);