]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib: utils: Switch matches() to returning int again
authorPetr Machata <petrm@nvidia.com>
Wed, 22 Nov 2023 15:23:28 +0000 (16:23 +0100)
committerDavid Ahern <dsahern@kernel.org>
Wed, 22 Nov 2023 19:31:55 +0000 (19:31 +0000)
commit60254925ccab10cfd24dc43c91cb95e50f65c7cf
tree44a5672be67be9295ae3b9cc79a1cffa2654d6c6
parente4956e7f1fd9bb8d8bf74947c32ac381e19b96ec
lib: utils: Switch matches() to returning int again

Since commit 1f420318bda3 ("utils: don't match empty strings as prefixes")
the function has pretended to return a boolean. But every user expects it
to return zero on success and a non-zero value on failure, like strcmp().
Even the function itself actually returns "true" to mean "no match". This
only makes sense if one considers a boolean to be a one-bit unsigned
integer with no inherent meaning, which I do not think is reasonable.

Switch the prototype back to int, and return 1 instead of true.

Cc: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
include/utils.h
lib/utils.c