diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-06-05 17:22:11 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-06-07 15:28:50 +0200 |
commit | 69ce73d18d474f3531e52ade69a2a4725466888f (patch) | |
tree | 0bdc8647ddb5703dfbab878a68313e5628af0373 /src/core/device.c | |
parent | core: add a new unit method "catchup()" (diff) | |
download | systemd-69ce73d18d474f3531e52ade69a2a4725466888f.tar.xz systemd-69ce73d18d474f3531e52ade69a2a4725466888f.zip |
device: simplify device_found_to_string_many() a tiny bit
No need to maintain a NULL marker at the end of the table if we know the
size of the array anyway.
Diffstat (limited to 'src/core/device.c')
-rw-r--r-- | src/core/device.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/device.c b/src/core/device.c index e92b982439..21e90b8655 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -157,7 +157,6 @@ static const struct { { DEVICE_FOUND_UDEV_DB, "found-udev-db" }, { DEVICE_FOUND_MOUNT, "found-mount" }, { DEVICE_FOUND_SWAP, "found-swap" }, - {} }; static int device_found_to_string_many(DeviceFound flags, char **ret) { @@ -166,7 +165,7 @@ static int device_found_to_string_many(DeviceFound flags, char **ret) { assert(ret); - for (i = 0; device_found_map[i].name; i++) { + for (i = 0; i < ELEMENTSOF(device_found_map); i++) { if (!FLAGS_SET(flags, device_found_map[i].flag)) continue; @@ -196,7 +195,7 @@ static int device_found_from_string_many(const char *name, DeviceFound *ret) { if (r == 0) break; - for (i = 0; device_found_map[i].name; i++) + for (i = 0; i < ELEMENTSOF(device_found_map); i++) if (streq(word, device_found_map[i].name)) { f = device_found_map[i].flag; break; |