]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-rules: replace two udev_list_entry_foreach() by corresponding FOREACH_DEVICE_...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 29 Oct 2018 06:39:53 +0000 (15:39 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 7 Nov 2018 04:35:03 +0000 (13:35 +0900)
src/udev/udev-rules.c

index 49ee14c650f96b257667f594184aa1cb7602a5b7..a5ead0930b5d932b750693bf7f363467dbfb493c 100644 (file)
@@ -1767,18 +1767,15 @@ int udev_rules_apply_to_event(
                                 goto nomatch;
                         break;
                 case TK_M_DEVLINK: {
-                        struct udev_list_entry *list_entry;
+                        const char *devlink;
                         bool match = false;
 
-                        udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) {
-                                const char *devlink;
-
-                                devlink = udev_list_entry_get_name(list_entry) + STRLEN("/dev/");
-                                if (match_key(rules, cur, devlink) == 0) {
+                        FOREACH_DEVICE_DEVLINK(event->dev->device, devlink)
+                                if (match_key(rules, cur, devlink + STRLEN("/dev/")) == 0) {
                                         match = true;
                                         break;
                                 }
-                        }
+
                         if (!match)
                                 goto nomatch;
                         break;
@@ -1802,15 +1799,15 @@ int udev_rules_apply_to_event(
                         break;
                 }
                 case TK_M_TAG: {
-                        struct udev_list_entry *list_entry;
                         bool match = false;
+                        const char *tag;
 
-                        udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) {
-                                if (streq(rules_str(rules, cur->key.value_off), udev_list_entry_get_name(list_entry))) {
+                        FOREACH_DEVICE_TAG(event->dev->device, tag)
+                                if (streq(rules_str(rules, cur->key.value_off), tag)) {
                                         match = true;
                                         break;
                                 }
-                        }
+
                         if ((!match && (cur->key.op != OP_NOMATCH)) ||
                             (match && (cur->key.op == OP_NOMATCH)))
                                 goto nomatch;