diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-06-14 12:33:22 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-06-14 12:33:22 -0400 |
commit | a126523db70b872795c488f947f8a9315f2d5118 (patch) | |
tree | 99d286cb3b11058f73bb3abffbbabd4a8bbbc746 | |
parent | 6efdaa8ac39129bfd31ec14cae1075075688ab95 (diff) |
wsclean sets length to sz-2, so n == 0
-rw-r--r-- | read.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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 |