<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On May 10, 2017 7:14 AM, "Eric Engestrom" <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>><br>
---<br>
 src/evdev.c | 17 +++++++----------<br>
 1 file changed, 7 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/evdev.c b/src/evdev.c<br>
index a2be6fc..7895644 100644<br>
--- a/src/evdev.c<br>
+++ b/src/evdev.c<br>
@@ -50,6 +50,8 @@<br>
 #define DEFAULT_WHEEL_CLICK_ANGLE 15<br>
 #define DEFAULT_BUTTON_SCROLL_TIMEOUT ms2us(200)<br>
<br>
+#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a)[0])<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I'm guessing this works, but "sizeof(a)[0]" looks very unintuitive to me. I think "sizeof(a[0])" is the convention?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
 enum evdev_key_type {<br>
        EVDEV_KEY_TYPE_NONE,<br>
        EVDEV_KEY_TYPE_KEY,<br>
@@ -90,9 +92,6 @@ static const struct evdev_udev_tag_match evdev_udev_tag_matches[] = {<br>
        {"ID_INPUT_POINTINGSTICK",      EVDEV_UDEV_TAG_POINTINGSTICK},<br>
        {"ID_INPUT_TRACKBALL",          EVDEV_UDEV_TAG_TRACKBALL},<br>
        {"ID_INPUT_SWITCH",             EVDEV_UDEV_TAG_SWITCH},<br>
-<br>
-       /* sentinel value */<br>
-       {0, 0},<br>
 };<br>
<br>
 static inline bool<br>
@@ -2373,18 +2372,16 @@ evdev_device_get_udev_tags(<wbr>struct evdev_device *device,<br>
                           struct udev_device *udev_device)<br>
 {<br>
        enum evdev_device_udev_tags tags = 0;<br>
-       const struct evdev_udev_tag_match *match;<br>
        int i;<br>
<br>
        for (i = 0; i < 2 && udev_device; i++) {<br>
-               match = evdev_udev_tag_matches;<br>
-               while (match->name) {<br>
+               unsigned j;<br>
+               for (j = 0; j < ARRAY_SIZE(evdev_udev_tag_<wbr>matches); j++) {<br>
+                       const struct evdev_udev_tag_match match = evdev_udev_tag_matches[j];<br>
                        if (parse_udev_flag(device,<br>
                                            udev_device,<br>
-                                           match->name))<br>
-                               tags |= match->tag;<br>
-<br>
-                       match++;<br>
+                                           <a href="http://match.name" rel="noreferrer" target="_blank">match.name</a>))<br>
+                               tags |= match.tag;<br>
                }<br>
                udev_device = udev_device_get_parent(udev_<wbr>device);<br>
        }<br>
<font color="#888888">--<br>
Cheers,<br>
  Eric<br>
<br>
______________________________<wbr>_________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/wayland-devel</a><br>
</font></blockquote></div><br></div></div></div>