diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-09-09 17:43:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 17:43:38 +0200 |
commit | 12ce0f41735e3d179c41deee99d9abe8aae52527 (patch) | |
tree | 13ba019fd7e4232da90de24f9ee36f6a669b4833 /src/cryptsetup | |
parent | Merge pull request #16972 from wusto/ambient-and-keep-caps-corrections (diff) | |
parent | Rename strv_split_extract() to strv_split_full() (diff) | |
download | systemd-12ce0f41735e3d179c41deee99d9abe8aae52527.tar.xz systemd-12ce0f41735e3d179c41deee99d9abe8aae52527.zip |
Merge pull request #16635 from keszybz/do-not-for-each-word
Drop FOREACH_WORD
Diffstat (limited to 'src/cryptsetup')
-rw-r--r-- | src/cryptsetup/cryptsetup.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c index f9e627da46..7d0571f147 100644 --- a/src/cryptsetup/cryptsetup.c +++ b/src/cryptsetup/cryptsetup.c @@ -288,19 +288,19 @@ static int parse_one_option(const char *option) { } static int parse_options(const char *options) { - const char *word, *state; - size_t l; - int r; - assert(options); - FOREACH_WORD_SEPARATOR(word, l, options, ",", state) { - _cleanup_free_ char *o; + for (;;) { + _cleanup_free_ char *word = NULL; + int r; + + r = extract_first_word(&options, &word, ",", EXTRACT_DONT_COALESCE_SEPARATORS); + if (r < 0) + return log_debug_errno(r, "Failed to parse options: %m"); + if (r == 0) + break; - o = strndup(word, l); - if (!o) - return -ENOMEM; - r = parse_one_option(o); + r = parse_one_option(word); if (r < 0) return r; } |