1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 14:08:06 +01:00

WPrefs: 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:22 +01:00
committed by Carlos R. Mafra
parent be022d9623
commit 01c7390be1
5 changed files with 8 additions and 8 deletions

View File

@@ -115,11 +115,11 @@ static void createPanel(Panel * p)
WMSetScrollViewHasHorizontalScroller(sv, False);
f = WMCreateFrame(panel->box);
WMResizeWidget(f, 495, (sizeof(expert_options) / sizeof(expert_options[0])) * 25 + 8);
WMResizeWidget(f, 495, wlengthof(expert_options) * 25 + 8);
WMSetFrameRelief(f, WRFlat);
udb = WMGetStandardUserDefaults();
for (i = 0; i < sizeof(expert_options) / sizeof(expert_options[0]); i++) {
for (i = 0; i < wlengthof(expert_options); i++) {
panel->swi[i] = WMCreateSwitchButton(f);
WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
WMMoveWidget(panel->swi[i], 5, 5 + i * 25);
@@ -152,7 +152,7 @@ static void storeDefaults(_Panel * panel)
WMUserDefaults *udb = WMGetStandardUserDefaults();
int i;
for (i = 0; i < sizeof(expert_options) / sizeof(expert_options[0]); i++) {
for (i = 0; i < wlengthof(expert_options); i++) {
switch (expert_options[i].class) {
case OPTION_WMAKER:
SetBoolForKey(WMGetButtonSelected(panel->swi[i]), expert_options[i].op_name);