diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2009-12-21 15:41:25 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2009-12-21 15:41:25 +0100 |
commit | b73bf332c2da4f539d029d5e9a09af76df12181f (patch) | |
tree | bf1a2387d04ee3e6d1674e53c375d3e177658fa5 /libudev | |
parent | c71d6a45aadbf69b394442e8b89c35db33afcff3 (diff) |
Speed up udev_enumerate_scan_*
Check property match earlier, to avoid lots of readlink() and stat()
calls when we check property matches.
Diffstat (limited to 'libudev')
-rw-r--r-- | libudev/libudev-enumerate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 2fcd348296..53cd53b694 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -574,6 +574,8 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); + if (!match_property(udev_enumerate, syspath)) + continue; if (lstat(syspath, &statbuf) != 0) continue; if (S_ISREG(statbuf.st_mode)) @@ -586,8 +588,6 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; if (!match_sysattr(udev_enumerate, syspath)) continue; - if (!match_property(udev_enumerate, syspath)) - continue; syspath_add(udev_enumerate, syspath); } closedir(dir); |