mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
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.
This commit is contained in:
parent
3ff13c298d
commit
8372da448f
@ -39,13 +39,13 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
|
|||||||
assert(p);
|
assert(p);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
if (!separators)
|
|
||||||
separators = WHITESPACE;
|
|
||||||
|
|
||||||
/* Bail early if called after last value or with no input */
|
/* Bail early if called after last value or with no input */
|
||||||
if (!*p)
|
if (!*p)
|
||||||
goto finish_force_terminate;
|
goto finish_force_terminate;
|
||||||
|
|
||||||
|
if (!separators)
|
||||||
|
separators = WHITESPACE;
|
||||||
|
|
||||||
/* Parses the first word of a string, and returns it in
|
/* Parses the first word of a string, and returns it in
|
||||||
* *ret. Removes all quotes in the process. When parsing fails
|
* *ret. Removes all quotes in the process. When parsing fails
|
||||||
* (because of an uneven number of quotes or similar), leaves
|
* (because of an uneven number of quotes or similar), leaves
|
||||||
|
Loading…
Reference in New Issue
Block a user