1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-30 18:32:34 +01:00

util: Use the macro 'wlengthof' to get the number of element in an array

The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-11-08 21:18:23 +01:00
committed by Carlos R. Mafra
parent 01c7390be1
commit 59f5aeeec5

View File

@@ -108,7 +108,7 @@ static char *mapWeightToName(str * weight)
if (weight->len == 0) if (weight->len == 0)
return ""; return "";
for (i = 0; i < sizeof(normalNames) / sizeof(normalNames[0]); i++) { for (i = 0; i < wlengthof(normalNames); i++) {
if (strlen(normalNames[i]) == weight->len && strncmp(normalNames[i], weight->str, weight->len)) { if (strlen(normalNames[i]) == weight->len && strncmp(normalNames[i], weight->str, weight->len)) {
return ""; return "";
} }