Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
libfetch: use more modern getline() interface
Daniel Kolesa committed 3 years ago
commit 0574f6b40b328fdf46a927c037c0481114730a28
parent 562c0e9
1 file changed +5 -3
modified external/libfetch/http.c
@@ -1507,12 +1507,12 @@ http_get_proxy(struct url * url, const char *flags)
static void
http_print_html(FILE *out, FILE *in)
{
-
	size_t len;
-
	char *line, *p, *q;
+
	size_t len = 0;
+
	char *line = NULL, *p, *q;
	int comment, tag;

	comment = tag = 0;
-
	while ((line = fgetln(in, &len)) != NULL) {
+
	while (getline(&line, &len, in) >= 0) {
		while (len && isspace((unsigned char)line[len - 1]))
			--len;
		for (p = q = line; q < line + len; ++q) {
@@ -1540,6 +1540,8 @@ http_print_html(FILE *out, FILE *in)
			fwrite(p, q - p, 1, out);
		fputc('\n', out);
	}
+

+
	free(line);
}