From a126523db70b872795c488f947f8a9315f2d5118 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Sun, 14 Jun 2020 12:33:22 -0400
Subject: wsclean sets length to sz-2, so n == 0
---
read.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/read.c b/read.c
index 5d7602d..f1ecea9 100644
--- a/read.c
+++ b/read.c
@@ -42,7 +42,6 @@ static char* getline(size_t* n, FILE* file) {
if (c == '\n') break;
}
out[(*n)] = 0;
- //(*n)++;
return realloc(out, sizeof(char) * (*n+1) );
}
@@ -51,7 +50,7 @@ static char* line(FILE* file, bool nl) { // gets a line from file
char* link = getline(&n, file);
// getline stores a line of len n (size n+1) in link
wsclean(link, &n); // removes trailing whitespace
- if (n == 1) { // "\n" => ""
+ if (n == 0) { // "\n" => ""
free(link);
return empty();
} else { // else return obtained
--
cgit