summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Engestrom <eric.engestrom@imgtec.com>2017-05-10 13:06:32 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-11 10:29:50 +1000
commit368006ef40673125228a6c0f7b0528a4ecff0487 (patch)
treeffe8328633d97931e7ee059124c815de9c93a365 /src
parent07ed6d6f9275eb027e3d28d5d6a757687b49e719 (diff)
evdev: replace null sentinel with ARRAY_SIZE
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/evdev.c b/src/evdev.c
index d24a564..ba9975f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -90,9 +90,6 @@ static const struct evdev_udev_tag_match evdev_udev_tag_matches[] = {
{"ID_INPUT_POINTINGSTICK", EVDEV_UDEV_TAG_POINTINGSTICK},
{"ID_INPUT_TRACKBALL", EVDEV_UDEV_TAG_TRACKBALL},
{"ID_INPUT_SWITCH", EVDEV_UDEV_TAG_SWITCH},
-
- /* sentinel value */
- { 0 },
};
static inline bool
@@ -2373,18 +2370,16 @@ evdev_device_get_udev_tags(struct evdev_device *device,
struct udev_device *udev_device)
{
enum evdev_device_udev_tags tags = 0;
- const struct evdev_udev_tag_match *match;
int i;
for (i = 0; i < 2 && udev_device; i++) {
- match = evdev_udev_tag_matches;
- while (match->name) {
+ unsigned j;
+ for (j = 0; j < ARRAY_LENGTH(evdev_udev_tag_matches); j++) {
+ const struct evdev_udev_tag_match match = evdev_udev_tag_matches[j];
if (parse_udev_flag(device,
udev_device,
- match->name))
- tags |= match->tag;
-
- match++;
+ match.name))
+ tags |= match.tag;
}
udev_device = udev_device_get_parent(udev_device);
}