From 9d8145acfc7eba688387c7d3ac4494d39056b30b Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sun, 21 Jul 2024 18:18:08 +0200 Subject: [PATCH] lib/gshadow.c: endsgent(): Invert logic to reduce indentation Signed-off-by: Alejandro Colomar --- lib/gshadow.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/gshadow.c b/lib/gshadow.c index 6a5cd67b..8e9d6c82 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -155,29 +155,29 @@ void endsgent (void) return NULL; } - if (fgetsx(buf, buflen, fp) == buf) { - while ( (strrchr(buf, '\n') == NULL) - && (feof (fp) == 0)) { - size_t len; + if (fgetsx(buf, buflen, fp) == NULL) + return NULL; - cp = REALLOC(buf, buflen * 2, char); - if (NULL == cp) { - return NULL; - } - buf = cp; - buflen *= 2; + while ( (strrchr(buf, '\n') == NULL) + && (feof (fp) == 0)) { + size_t len; - len = strlen (buf); - if (fgetsx (&buf[len], - (int) (buflen - len), - fp) != &buf[len]) { - return NULL; - } + cp = REALLOC(buf, buflen * 2, char); + if (NULL == cp) { + return NULL; + } + buf = cp; + buflen *= 2; + + len = strlen (buf); + if (fgetsx (&buf[len], + (int) (buflen - len), + fp) != &buf[len]) { + return NULL; } - stpsep(buf, "\n"); - return (sgetsgent (buf)); } - return NULL; + stpsep(buf, "\n"); + return (sgetsgent (buf)); } /*