]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib: utils: Generalize parse_one_of()
authorPetr Machata <petrm@nvidia.com>
Wed, 22 Nov 2023 15:23:29 +0000 (16:23 +0100)
committerDavid Ahern <dsahern@kernel.org>
Wed, 22 Nov 2023 19:31:59 +0000 (19:31 +0000)
commit256e0ca4b84f585ed0a3fcdc14216498d2e02b45
tree3c793268ef519274f3169ddb82f4f6fbbc51ddee
parent60254925ccab10cfd24dc43c91cb95e50f65c7cf
lib: utils: Generalize parse_one_of()

The following patch will change the way parse_one_of() and parse_on_off()
parse the strings they are given. To prepare for this change, extract from
parse_one_of() the functional core, which express in terms of a
configurable matcher, a pointer to a function that does the string
comparison. Then rewrite parse_one_of() and parse_on_off() as wrappers that
just pass matches() as the matcher, thereby maintaining the same behavior
as they currently have.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
lib/utils.c