bool rc = false;
size_t ncodes = 0;
size_t idx;
- struct input_event evs[*nevents];
+ /* A randomly chosen max so we avoid crazy quirks */
+ struct input_event evs[32];
memset(evs, 0, sizeof evs);
for (idx = 0; strv[idx]; idx++)
ncodes++;
- /* A randomly chosen max so we avoid crazy quirks */
- if (ncodes == 0 || ncodes > 32)
+ if (ncodes == 0 || ncodes > ARRAY_LENGTH(evs))
goto out;
ncodes = min(*nevents, ncodes);
p->value.s = safe_strdup(value);
rc = true;
} else if (streq(key, quirk_get_name(QUIRK_ATTR_EVENT_CODE_DISABLE))) {
- size_t nevents = 32;
- struct input_event events[nevents];
+ struct input_event events[32];
+ size_t nevents = ARRAY_LENGTH(events);
p->id = QUIRK_ATTR_EVENT_CODE_DISABLE;
if (!parse_evcode_property(value, events, &nevents) ||
nevents == 0)
START_TEST(keyboard_seat_key_count)
{
- const int num_devices = 4;
- struct litest_device *devices[num_devices];
+ struct litest_device *devices[4];
+ const int num_devices = ARRAY_LENGTH(devices);
struct libinput *libinput;
struct libinput_event *ev;
struct libinput_event_keyboard *kev;
START_TEST(pointer_seat_button_count)
{
- const int num_devices = 4;
- struct litest_device *devices[num_devices];
+ struct litest_device *devices[4];
+ const int num_devices = ARRAY_LENGTH(devices);
struct libinput *libinput;
struct libinput_event *ev;
struct libinput_event_pointer *tev;
for (int i = 0; tests[i].prop; i++) {
bool success;
- size_t nevents = 32;
- struct input_event events[nevents];
+ struct input_event events[32];
+ size_t nevents = ARRAY_LENGTH(events);
t = &tests[i];
success = parse_evcode_property(t->prop, events, &nevents);