From c162b75317f93503eeab83caf86de6738c3220f4 Mon Sep 17 00:00:00 2001 From: David Crosby Date: Sat, 25 Jul 2015 22:47:24 -0600 Subject: Use fgetc in while loops, use int instead of char --- Str.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'Str.c') diff --git a/Str.c b/Str.c index f819dbf..70e9957 100644 --- a/Str.c +++ b/Str.c @@ -530,11 +530,8 @@ Str Strfgets(FILE * f) { Str s = Strnew(); - char c; - while (1) { - c = fgetc(f); - if (feof(f) || ferror(f)) - break; + int c; + while ((c = fgetc(f)) != EOF) { Strcat_char(s, c); if (c == '\n') break; @@ -546,11 +543,8 @@ Str Strfgetall(FILE * f) { Str s = Strnew(); - char c; - while (1) { - c = fgetc(f); - if (feof(f) || ferror(f)) - break; + int c; + while ((c = fgetc(f)) != EOF) { Strcat_char(s, c); } return s; -- cgit v1.2.3