aboutsummaryrefslogtreecommitdiff
path: root/xs_io.h
diff options
context:
space:
mode:
authorshtrophic <christoph@liebender.dev>2025-02-15 14:37:36 +0100
committershtrophic <christoph@liebender.dev>2025-02-15 14:37:36 +0100
commit7611a6bee4bcbad2f1710aafa99aba730e5cf995 (patch)
tree33ab7bee30379e16f6869b2efda5494be8aeb858 /xs_io.h
parent3d96c576287736ebdf87e4a7b956842a6c6e055f (diff)
parent3d705b22a67ee913b9bd4473277430bd481cef25 (diff)
Merge tag '2.72' into curl-smtp
Version 2.72 RELEASED.
Diffstat (limited to 'xs_io.h')
-rw-r--r--xs_io.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/xs_io.h b/xs_io.h
index 110b0eb..9c5018e 100644
--- a/xs_io.h
+++ b/xs_io.h
@@ -14,7 +14,7 @@ xs_val *xs_readall(FILE *f);
xs_str *xs_readline(FILE *f)
/* reads a line from a file */
{
- xs_str *s = NULL;
+ xs_str *s = xs_str_new(NULL);
errno = 0;
@@ -22,12 +22,11 @@ xs_str *xs_readline(FILE *f)
if (!feof(f)) {
int c;
- s = xs_str_new(NULL);
-
while ((c = fgetc(f)) != EOF) {
unsigned char rc = c;
- s = xs_append_m(s, (char *)&rc, 1);
+ if (xs_is_string((char *)&rc))
+ s = xs_append_m(s, (char *)&rc, 1);
if (c == '\n')
break;