summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2015-11-05 21:31:29 -0800
committerFilipe Brandenburger <filbranden@google.com>2015-11-05 21:31:29 -0800
commit8372da448f3c738e0154d988538d497f7e2e1f83 (patch)
tree83533efe5ccea8c0dfacb066280a5fe66393fc63 /src/basic
parent3ff13c298d6d53293680c383768c3054fb9fcc30 (diff)
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.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/extract-word.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/extract-word.c b/src/basic/extract-word.c
index 1b3123bb7d..b08851b89b 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