From: Jens Axboe Date: Fri, 30 May 2008 20:33:47 +0000 (+0200) Subject: Cleanup lib/strsep.c X-Git-Tag: fio-1.21-rc4~17 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fb9ee07258a56347a5dcfb17a7de31d10f3cd166 Cleanup lib/strsep.c Signed-off-by: Jens Axboe --- diff --git a/lib/strsep.c b/lib/strsep.c index f8e55b53..b71e9f7b 100644 --- a/lib/strsep.c +++ b/lib/strsep.c @@ -2,25 +2,28 @@ char *strsep(char **stringp, const char *delim) { - char *s; - const char *spanp; - int c, sc; - char *tok; + char *s, *tok; + const char *spanp; + int c, sc; - if ((s = *stringp) == NULL) - return (NULL); - for (tok = s;;) { - c = *s++; - spanp = delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) - s = NULL; - else - s[-1] = 0; - *stringp = s; - return (tok); - } - } while (sc != 0); - } + s = *stringp; + if (!s) + return NULL; + + tok = s; + do { + c = *s++; + spanp = delim; + do { + sc = *spanp++; + if (sc == c) { + if (c == 0) + s = NULL; + else + s[-1] = 0; + *stringp = s; + return tok; + } + } while (sc != 0); + } while (1); }