aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lib.h2
-rw-r--r--lib/xwrap.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/lib.h b/lib/lib.h
index 192fb7d2..150133b6 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -188,7 +188,7 @@ void xsignal_flags(int signal, void *handler, int flags);
void xsignal(int signal, void *handler);
time_t xvali_date(struct tm *tm, char *str);
void xparsedate(char *str, time_t *t, unsigned *nano, int endian);
-char *xgetline(FILE *fp, int *len);
+char *xgetline(FILE *fp);
time_t xmktime(struct tm *tm, int utc);
// lib.c
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 26fcb8df..22f00f2b 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -1072,18 +1072,18 @@ void xparsedate(char *str, time_t *t, unsigned *nano, int endian)
free(oldtz);
}
-char *xgetline(FILE *fp, int *len)
+// Return line of text from file. Strips trailing newline (if any).
+char *xgetline(FILE *fp)
{
char *new = 0;
- size_t linelen = 0;
+ size_t len = 0;
long ll;
errno = 0;
- if (1>(ll = getline(&new, &linelen, fp))) {
+ if (1>(ll = getline(&new, &len, fp))) {
if (errno && errno != EINTR) perror_msg("getline");
new = 0;
} else if (new[ll-1] == '\n') new[--ll] = 0;
- if (len) *len = ll;
return new;
}