From: Filipe Brandenburger Date: Fri, 6 Nov 2015 05:31:29 +0000 (-0800) Subject: extract-word: Check for early bail out before inspecting separators X-Git-Tag: v228~67^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8372da448f3c738e0154d988538d497f7e2e1f83;p=thirdparty%2Fsystemd.git extract-word: Check for early bail out before inspecting separators It's a pretty small optimization but doesn't hurt... Tested with test-extract-word. --- diff --git a/src/basic/extract-word.c b/src/basic/extract-word.c index 1b3123bb7d8..b08851b89bc 100644 --- a/src/basic/extract-word.c +++ b/src/basic/extract-word.c @@ -39,13 +39,13 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra assert(p); assert(ret); - if (!separators) - separators = WHITESPACE; - /* Bail early if called after last value or with no input */ if (!*p) goto finish_force_terminate; + if (!separators) + separators = WHITESPACE; + /* Parses the first word of a string, and returns it in * *ret. Removes all quotes in the process. When parsing fails * (because of an uneven number of quotes or similar), leaves