Skip to content

Commit

Permalink
evdev: replace null sentinel with ARRAY_SIZE
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
1ace authored and whot committed May 11, 2017
1 parent 07ed6d6 commit 368006e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 368006e

Please sign in to comment.