]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device-enumerator: use set_fnmatch()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 25 Apr 2022 02:19:56 +0000 (11:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Apr 2022 07:32:42 +0000 (16:32 +0900)
src/libsystemd/sd-device/device-enumerator.c

index 757f7489271955451a0fbca6d7542f7bf711a42d..977f4ef24ad1f2dc27a07fd4afa10d84adf78577 100644 (file)
@@ -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(