diff --git a/WINGs/menuparser.c b/WINGs/menuparser.c index e4f616c1..db0225bf 100644 --- a/WINGs/menuparser.c +++ b/WINGs/menuparser.c @@ -596,7 +596,7 @@ static void menu_parser_condition_ifmacro(WMenuParser parser, Bool check_exists) parser->rd++; /* Add this condition to the stack of conditions */ - if (parser->cond.depth >= sizeof(parser->cond.stack) / sizeof(parser->cond.stack[0])) { + if (parser->cond.depth >= wlengthof(parser->cond.stack)) { WMenuParserError(parser, _("too many nested #if sequences") ); return; } diff --git a/WINGs/menuparser_macros.c b/WINGs/menuparser_macros.c index 2b093db8..5b98ef85 100644 --- a/WINGs/menuparser_macros.c +++ b/WINGs/menuparser_macros.c @@ -190,7 +190,7 @@ void menu_parser_define_macro(WMenuParser parser) } if (*parser->rd == ')') break; - if (macro->arg_count >= sizeof(arg_name) / sizeof(arg_name[0])) { + if (macro->arg_count >= wlengthof(arg_name)) { WMenuParserError(parser, _("too many parameters for macro \"%s\" definition"), macro->name); wfree(macro); *parser->rd = '\0'; // fake end-of-line to avoid warnings from remaining line content diff --git a/WINGs/wfontpanel.c b/WINGs/wfontpanel.c index 3f290517..0c1d3fdb 100644 --- a/WINGs/wfontpanel.c +++ b/WINGs/wfontpanel.c @@ -442,7 +442,7 @@ static void addSizeToTypeface(Typeface * face, int size) if (size == 0) { int j; - for (j = 0; j < sizeof(scalableFontSizes) / sizeof(scalableFontSizes[0]); j++) { + for (j = 0; j < wlengthof(scalableFontSizes); j++) { size = scalableFontSizes[j]; if (!WMCountInArray(face->sizes, (void *)(uintptr_t) size)) { diff --git a/WINGs/widgets.c b/WINGs/widgets.c index 7b9ffe86..75b44e70 100644 --- a/WINGs/widgets.c +++ b/WINGs/widgets.c @@ -550,7 +550,7 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c "_NET_WM_ICON_NAME", "_NET_WM_ICON", }; - Atom atoms[sizeof(atomNames) / sizeof(atomNames[0])]; + Atom atoms[wlengthof(atomNames)]; int i; if (!initialized) { @@ -801,9 +801,9 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c } #ifdef HAVE_XINTERNATOMS - XInternAtoms(display, atomNames, sizeof(atomNames) / sizeof(atomNames[0]), False, atoms); + XInternAtoms(display, atomNames, wlengthof(atomNames), False, atoms); #else - for (i = 0; i < sizeof(atomNames) / sizeof(atomNames[0]); i++) { + for (i = 0; i < wlengthof(atomNames); i++) { atoms[i] = XInternAtom(display, atomNames[i], False); } #endif