return 0;
}
-#define N_ELEMENTS(x) sizeof(x) / sizeof(x[0])
-
XKB_EXPORT uint32_t
xkb_keysym_to_utf32(xkb_keysym_t keysym)
{
return keysym & 0x00ffffff;
/* search smaller keypad table */
- retval = bin_search(keysymtab_kp, N_ELEMENTS(keysymtab_kp) - 1, keysym);
+ retval = bin_search(keysymtab_kp, ARRAY_SIZE(keysymtab_kp) - 1, keysym);
/* search main table */
if (!retval)
- retval = bin_search(keysymtab, N_ELEMENTS(keysymtab) - 1, keysym);
+ retval = bin_search(keysymtab, ARRAY_SIZE(keysymtab) - 1, keysym);
return retval;
}
}
entry = bsearch(&search, keysym_to_name,
- sizeof(keysym_to_name) / sizeof(*keysym_to_name),
+ ARRAY_SIZE(keysym_to_name),
sizeof(*keysym_to_name),
compare_by_keysym);
if (entry)
find_sym(const struct name_keysym *entry, const char *name, bool icase)
{
const struct name_keysym *iter, *last;
- size_t len = sizeof(name_to_keysym) / sizeof(*name_to_keysym);
+ size_t len = ARRAY_SIZE(name_to_keysym);
if (!entry)
return NULL;
return XKB_KEY_NoSymbol;
entry = bsearch(&search, name_to_keysym,
- sizeof(name_to_keysym) / sizeof(*name_to_keysym),
+ ARRAY_SIZE(name_to_keysym),
sizeof(*name_to_keysym),
compare_by_name);
entry = find_sym(entry, s, icase);
return p;
}
+#define ARRAY_SIZE(arr) ((sizeof(arr) / sizeof(*(arr))))
+
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MIN3(a, b, c) MIN(MIN((a), (b)), (c))
#define MAX(a, b) ((a) > (b) ? (a) : (b))