summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-03-10 19:03:23 +0900
committerLennart Poettering <lennart@poettering.net>2022-03-18 09:43:09 +0100
commit29e6f70b8d2e0db7ecb781b07c9845c685c4bc8b (patch)
tree6556b6077f84c8848ec987d71c8e2fe658e7c69b
parentf79856d9e8f413040771a1451fc2ac9c168f8c3a (diff)
downloadsystemd-29e6f70b8d2e0db7ecb781b07c9845c685c4bc8b.tar.gz
sd-device-enumerator: fix typo: contolC -> controlC
Also shorten code a bit.
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index 4f1719b3ed..4942ee43a8 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;
}
}
}