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:
committed by
Carlos R. Mafra
parent
01c7390be1
commit
59f5aeeec5
@@ -108,7 +108,7 @@ static char *mapWeightToName(str * weight)
|
||||
if (weight->len == 0)
|
||||
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)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user