From: Yu Watanabe Date: Mon, 25 Apr 2022 02:19:56 +0000 (+0900) Subject: sd-device-enumerator: use set_fnmatch() X-Git-Tag: v251-rc2~58^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c11810ed30bdcc5277592eb1ecee36457e11bac9;p=thirdparty%2Fsystemd.git sd-device-enumerator: use set_fnmatch() --- diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index 757f7489271..977f4ef24ad 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -580,25 +580,12 @@ static int test_matches( } static bool match_subsystem(sd_device_enumerator *enumerator, const char *subsystem) { - const char *subsystem_match; - assert(enumerator); if (!subsystem) return false; - SET_FOREACH(subsystem_match, enumerator->nomatch_subsystem) - if (fnmatch(subsystem_match, subsystem, 0) == 0) - return false; - - if (set_isempty(enumerator->match_subsystem)) - return true; - - SET_FOREACH(subsystem_match, enumerator->match_subsystem) - if (fnmatch(subsystem_match, subsystem, 0) == 0) - return true; - - return false; + return set_fnmatch(enumerator->match_subsystem, enumerator->nomatch_subsystem, subsystem); } static int enumerator_add_parent_devices(