From ffe164c09e6b51d474eb9d72afc0a35152590912 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 6 Jul 2017 11:00:07 +0200 Subject: [PATCH] Comment --- m-string.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/m-string.h b/m-string.h index 939a602f..a9de3ba9 100644 --- a/m-string.h +++ b/m-string.h @@ -540,19 +540,20 @@ string_fgets(string_t v, FILE *f, string_fgets_t arg) M_ASSUME(v->ptr != NULL); v->size = 0; v->ptr[0] = 0; - bool retcode = false; + bool retcode = false; /* Nothing has been read yet */ while (fgets(&v->ptr[v->size], v->alloc - v->size, f) != NULL) { - retcode = true; + retcode = true; /* Something has been read */ char *p = strchr(&v->ptr[v->size], '\n'); v->size += strlen(&v->ptr[v->size]); STRING_CONTRACT(v); if (arg != STRING_READ_FILE && p != NULL) { if (arg == STRING_READ_PURE_LINE) { + /* Remove EOL */ *p = 0; v->size --; } STRING_CONTRACT(v); - return retcode; + return retcode; /* Normal terminaison */ } else if (p == NULL && !feof(f)) { /* The string buffer is not big enough: increase it and continue reading */ @@ -560,7 +561,7 @@ string_fgets(string_t v, FILE *f, string_fgets_t arg) } } STRING_CONTRACT (v); - return retcode; + return retcode; /* Abnormal terminaison */ } static inline void