]> err.no Git - systemd/commitdiff
move variable inside condition
authorKay Sievers <kay.sievers@vrfy.org>
Mon, 23 Jan 2012 04:21:13 +0000 (05:21 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Mon, 23 Jan 2012 04:21:13 +0000 (05:21 +0100)
src/udev-event.c

index 227c186236ad487d56d02ddab69d011d87d42cea..0b6db30edad4f56d0a5471e0abe06a671a242d25 100644 (file)
@@ -347,12 +347,12 @@ subst:
                                 l = util_strpcpy(&s, l, udev_device_get_devnode(dev));
                         break;
                 case SUBST_NAME: {
-                        size_t devlen = strlen(udev_get_dev_path(event->udev))+1;
-
                         if (event->name != NULL) {
                                 l = util_strpcpy(&s, l, event->name);
                                 dbg(event->udev, "substitute custom name '%s'\n", event->name);
                         } else {
+                                size_t devlen = strlen(udev_get_dev_path(event->udev))+1;
+
                                 l = util_strpcpy(&s, l, &udev_device_get_devnode(dev)[devlen]);
                                 dbg(event->udev, "substitute name'%s'\n", &udev_device_get_devnode(dev)[devlen]);
                         }