diff options
author | Kay Sievers <kay@vrfy.org> | 2012-04-16 20:27:44 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-04-16 20:54:17 +0200 |
commit | 33502ffe2eb7b56cdd018a4fb6830d7828519fad (patch) | |
tree | 02180c0a82618b09f7346edaa7b28dd93eb81c9f /src/libudev/libudev-enumerate.c | |
parent | 6ada823a9a0979ea145fd70add1007c21caa45c0 (diff) |
udev: use startswith() and streq()
Diffstat (limited to 'src/libudev/libudev-enumerate.c')
-rw-r--r-- | src/libudev/libudev-enumerate.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c index ed4f62c66c..4725912c36 100644 --- a/src/libudev/libudev-enumerate.c +++ b/src/libudev/libudev-enumerate.c @@ -232,7 +232,7 @@ static size_t devices_delay_later(struct udev *udev, const char *syspath) c += 11; c += strcspn(c, "/"); - if (strncmp(c, "/controlC", 9) == 0) + if (startswith(c, "/controlC")) return c - syspath + 1; } @@ -595,13 +595,10 @@ static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device static bool match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - const char *parent; - if (udev_enumerate->parent_match == NULL) return true; - parent = udev_device_get_devpath(udev_enumerate->parent_match); - return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; + return startswith(udev_device_get_devpath(dev), udev_device_get_devpath(udev_enumerate->parent_match)); } static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) |