From: Yu Watanabe Date: Thu, 10 Mar 2022 10:03:23 +0000 (+0900) Subject: sd-device-enumerator: fix typo: contolC -> controlC X-Git-Tag: v251-rc1~120 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29e6f70b8d2e0db7ecb781b07c9845c685c4bc8b;p=thirdparty%2Fsystemd.git sd-device-enumerator: fix typo: contolC -> controlC Also shorten code a bit. --- diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index 4f1719b3ed2..4942ee43a87 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -249,18 +249,15 @@ static int device_compare(sd_device * const *_a, sd_device * const *_b) { prefix_len = sound_a - devpath_a; - if (strncmp(devpath_a, devpath_b, prefix_len) == 0) { + if (strneq(devpath_a, devpath_b, prefix_len)) { const char *sound_b; sound_b = devpath_b + prefix_len; - if (startswith(sound_a, "/controlC") && - !startswith(sound_b, "/contolC")) - return 1; - - if (!startswith(sound_a, "/controlC") && - startswith(sound_b, "/controlC")) - return -1; + r = CMP(!!startswith(sound_a, "/controlC"), + !!startswith(sound_b, "/controlC")); + if (r != 0) + return r; } } }