chiark / gitweb /
remove unused includes
[elogind.git] / src / libsystemd-network / network-internal.c
index 870858ccd7999905f9438ccd0b2c844f6e74850a..d579755cc81b15d17d58f76ee71c526366d9a50b 100644 (file)
 #include <netinet/ether.h>
 #include <linux/if.h>
 #include <arpa/inet.h>
-#include <fnmatch.h>
 
 #include "strv.h"
 #include "siphash24.h"
-#include "libudev-private.h"
 #include "dhcp-lease-internal.h"
 #include "log.h"
 #include "utf8.h"
@@ -97,10 +95,6 @@ bool net_match_config(const struct ether_addr *match_mac,
                       const char *dev_driver,
                       const char *dev_type,
                       const char *dev_name) {
-        char * const *match_path;
-        char * const *match_driver;
-        char * const *match_type;
-        char * const *match_name;
 
         if (match_host && !condition_test(match_host))
                 return false;
@@ -117,49 +111,21 @@ bool net_match_config(const struct ether_addr *match_mac,
         if (match_mac && (!dev_mac || memcmp(match_mac, dev_mac, ETH_ALEN)))
                 return false;
 
-        if (!strv_isempty(match_paths)) {
-                if (!dev_path)
-                        return false;
-
-                STRV_FOREACH(match_path, match_paths)
-                        if (fnmatch(*match_path, dev_path, 0) != 0)
-                                return true;
-
+        if (!strv_isempty(match_paths) &&
+            (!dev_path || !strv_fnmatch(match_paths, dev_path, 0)))
                 return false;
-        }
-
-        if (!strv_isempty(match_drivers)) {
-                if (!dev_driver)
-                        return false;
-
-                STRV_FOREACH(match_driver, match_drivers)
-                        if (fnmatch(*match_driver, dev_driver, 0) != 0)
-                                return true;
 
+        if (!strv_isempty(match_drivers) &&
+            (!dev_driver || !strv_fnmatch(match_drivers, dev_driver, 0)))
                 return false;
-        }
-
-        if (!strv_isempty(match_types)) {
-                if (!dev_type)
-                        return false;
-
-                STRV_FOREACH(match_type, match_types)
-                        if (fnmatch(*match_type, dev_type, 0) != 0)
-                                return true;
 
+        if (!strv_isempty(match_types) &&
+            (!dev_type || !strv_fnmatch_or_empty(match_types, dev_type, 0)))
                 return false;
-        }
-
-        if (!strv_isempty(match_names)) {
-                if (!dev_name)
-                        return false;
-
-                STRV_FOREACH(match_name, match_names)
-                        if (fnmatch(*match_name, dev_name, 0) != 0)
-                                return true;
 
+        if (!strv_isempty(match_names) &&
+            (!dev_name || !strv_fnmatch_or_empty(match_names, dev_name, 0)))
                 return false;
-        }
 
         return true;
 }