Skip to content

Commit 9e718b0

Browse files
Rename ArraySize() to MATTER_ARRAY_SIZE() (#37660)
* Rename ArraySize() to MATTER_ARRAY_SIZE * Updated usages of ArraySize() to MATTER_ARRAY_SIZE() * Restyled by clang-format * Guard with #ifndef * fix recently introduced usage in chime * fix typo --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 5fd96ed commit 9e718b0

File tree

185 files changed

+607
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+607
-567
lines changed

examples/air-quality-sensor-app/silabs/src/SensorManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void SensorManager::SensorTimerEventHandler(void * arg)
159159
static uint8_t simulatedIndex = 0;
160160

161161
// Ensure the simulatedIndex wraps around the array size to avoid out-of-bounds access
162-
simulatedIndex = simulatedIndex % ArraySize(mSimulatedAirQuality);
162+
simulatedIndex = simulatedIndex % MATTER_ARRAY_SIZE(mSimulatedAirQuality);
163163
// Retrieve the current air quality value from the simulated data array using the simulatedIndex
164164
air_quality = mSimulatedAirQuality[simulatedIndex];
165165

examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void DishwasherModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Comma
4141

4242
CHIP_ERROR DishwasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4343
{
44-
if (modeIndex >= ArraySize(kModeOptions))
44+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4545
{
4646
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4747
}
@@ -50,7 +50,7 @@ CHIP_ERROR DishwasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::
5050

5151
CHIP_ERROR DishwasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5252
{
53-
if (modeIndex >= ArraySize(kModeOptions))
53+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5454
{
5555
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5656
}
@@ -60,7 +60,7 @@ CHIP_ERROR DishwasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_
6060

6161
CHIP_ERROR DishwasherModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6262
{
63-
if (modeIndex >= ArraySize(kModeOptions))
63+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6464
{
6565
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6666
}

examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ EPrefDelegate::~EPrefDelegate()
7171

7272
size_t EPrefDelegate::GetNumEnergyBalances(chip::EndpointId aEndpoint)
7373
{
74-
return (ArraySize(gsEnergyBalances));
74+
return (MATTER_ARRAY_SIZE(gsEnergyBalances));
7575
}
7676

7777
size_t EPrefDelegate::GetNumLowPowerModeSensitivities(chip::EndpointId aEndpoint)
7878
{
79-
return (ArraySize(gsEnergyBalances));
79+
return (MATTER_ARRAY_SIZE(gsEnergyBalances));
8080
}
8181

8282
CHIP_ERROR
@@ -104,7 +104,7 @@ EPrefDelegate::GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aInde
104104
{
105105
static EnergyPriorityEnum priorities[] = { EnergyPriorityEnum::kEfficiency, EnergyPriorityEnum::kComfort };
106106

107-
if (aIndex < ArraySize(priorities))
107+
if (aIndex < MATTER_ARRAY_SIZE(priorities))
108108
{
109109
priority = priorities[aIndex];
110110
return CHIP_NO_ERROR;

examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LaundryDryerControlDelegate LaundryDryerControlDelegate::instance;
3131
// TODO: Add EndpointId to the API so that different values per endpoint may be possible in some implementations.
3232
CHIP_ERROR LaundryDryerControlDelegate::GetSupportedDrynessLevelAtIndex(size_t index, DrynessLevelEnum & supportedDrynessLevel)
3333
{
34-
if (index >= ArraySize(supportedDrynessLevelOptions))
34+
if (index >= MATTER_ARRAY_SIZE(supportedDrynessLevelOptions))
3535
{
3636
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
3737
}

examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ LaundryWasherControlDelegate LaundryWasherControlDelegate::instance;
3838

3939
CHIP_ERROR LaundryWasherControlDelegate::GetSpinSpeedAtIndex(size_t index, MutableCharSpan & spinSpeed)
4040
{
41-
if (index >= ArraySize(spinSpeedsNameOptions))
41+
if (index >= MATTER_ARRAY_SIZE(spinSpeedsNameOptions))
4242
{
4343
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4444
}
@@ -47,7 +47,7 @@ CHIP_ERROR LaundryWasherControlDelegate::GetSpinSpeedAtIndex(size_t index, Mutab
4747

4848
CHIP_ERROR LaundryWasherControlDelegate::GetSupportedRinseAtIndex(size_t index, NumberOfRinsesEnum & supportedRinse)
4949
{
50-
if (index >= ArraySize(supportRinsesOptions))
50+
if (index >= MATTER_ARRAY_SIZE(supportRinsesOptions))
5151
{
5252
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5353
}

examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void LaundryWasherModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Co
4040

4141
CHIP_ERROR LaundryWasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4242
{
43-
if (modeIndex >= ArraySize(kModeOptions))
43+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4444
{
4545
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4646
}
@@ -49,7 +49,7 @@ CHIP_ERROR LaundryWasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chi
4949

5050
CHIP_ERROR LaundryWasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5151
{
52-
if (modeIndex >= ArraySize(kModeOptions))
52+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5353
{
5454
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5555
}
@@ -59,7 +59,7 @@ CHIP_ERROR LaundryWasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uin
5959

6060
CHIP_ERROR LaundryWasherModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6161
{
62-
if (modeIndex >= ArraySize(kModeOptions))
62+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6363
{
6464
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6565
}

examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void ExampleMicrowaveOvenModeDelegate::HandleChangeToMode(uint8_t NewMode,
4242

4343
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4444
{
45-
if (modeIndex >= ArraySize(kModeOptions))
45+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4646
{
4747
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4848
}
@@ -51,7 +51,7 @@ CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeInd
5151

5252
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5353
{
54-
if (modeIndex >= ArraySize(kModeOptions))
54+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5555
{
5656
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5757
}
@@ -61,7 +61,7 @@ CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeInd
6161

6262
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6363
{
64-
if (modeIndex >= ArraySize(kModeOptions))
64+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6565
{
6666
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6767
}

examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void OvenModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::C
4242

4343
CHIP_ERROR OvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4444
{
45-
if (modeIndex >= ArraySize(kModeOptions))
45+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4646
{
4747
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4848
}
@@ -51,7 +51,7 @@ CHIP_ERROR OvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Mutabl
5151

5252
CHIP_ERROR OvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5353
{
54-
if (modeIndex >= ArraySize(kModeOptions))
54+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5555
{
5656
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5757
}
@@ -61,7 +61,7 @@ CHIP_ERROR OvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & va
6161

6262
CHIP_ERROR OvenModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6363
{
64-
if (modeIndex >= ArraySize(kModeOptions))
64+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6565
{
6666
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6767
}

examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
6868

6969
CHIP_ERROR RvcRunModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
7070
{
71-
if (modeIndex >= ArraySize(kModeOptions))
71+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
7272
{
7373
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
7474
}
@@ -77,7 +77,7 @@ CHIP_ERROR RvcRunModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Muta
7777

7878
CHIP_ERROR RvcRunModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
7979
{
80-
if (modeIndex >= ArraySize(kModeOptions))
80+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
8181
{
8282
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
8383
}
@@ -87,7 +87,7 @@ CHIP_ERROR RvcRunModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t &
8787

8888
CHIP_ERROR RvcRunModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
8989
{
90-
if (modeIndex >= ArraySize(kModeOptions))
90+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
9191
{
9292
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
9393
}
@@ -161,7 +161,7 @@ void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Command
161161

162162
CHIP_ERROR RvcCleanModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
163163
{
164-
if (modeIndex >= ArraySize(kModeOptions))
164+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
165165
{
166166
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
167167
}
@@ -170,7 +170,7 @@ CHIP_ERROR RvcCleanModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Mu
170170

171171
CHIP_ERROR RvcCleanModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
172172
{
173-
if (modeIndex >= ArraySize(kModeOptions))
173+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
174174
{
175175
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
176176
}
@@ -180,7 +180,7 @@ CHIP_ERROR RvcCleanModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t
180180

181181
CHIP_ERROR RvcCleanModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
182182
{
183-
if (modeIndex >= ArraySize(kModeOptions))
183+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
184184
{
185185
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
186186
}

examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void TccModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::Ch
4040

4141
CHIP_ERROR TccModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4242
{
43-
if (modeIndex >= ArraySize(kModeOptions))
43+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4444
{
4545
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4646
}
@@ -49,7 +49,7 @@ CHIP_ERROR TccModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Mutable
4949

5050
CHIP_ERROR TccModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5151
{
52-
if (modeIndex >= ArraySize(kModeOptions))
52+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5353
{
5454
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5555
}
@@ -59,7 +59,7 @@ CHIP_ERROR TccModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & val
5959

6060
CHIP_ERROR TccModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6161
{
62-
if (modeIndex >= ArraySize(kModeOptions))
62+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6363
{
6464
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6565
}

examples/all-clusters-app/ameba/main/BindingHandler.cpp

+23-18
Original file line numberDiff line numberDiff line change
@@ -584,32 +584,37 @@ static void RegisterSwitchCommands()
584584

585585
// Register groups command
586586
sShellSwitchGroupsIdentifySubCommands.RegisterCommands(sSwitchGroupsIdentifySubCommands,
587-
ArraySize(sSwitchGroupsIdentifySubCommands));
588-
sShellSwitchGroupsOnOffSubCommands.RegisterCommands(sSwitchGroupsOnOffSubCommands, ArraySize(sSwitchGroupsOnOffSubCommands));
587+
MATTER_ARRAY_SIZE(sSwitchGroupsIdentifySubCommands));
588+
sShellSwitchGroupsOnOffSubCommands.RegisterCommands(sSwitchGroupsOnOffSubCommands,
589+
MATTER_ARRAY_SIZE(sSwitchGroupsOnOffSubCommands));
589590
sShellSwitchGroupsLevelControlSubCommands.RegisterCommands(sSwitchGroupsLevelControlSubCommands,
590-
ArraySize(sSwitchGroupsLevelControlSubCommands));
591+
MATTER_ARRAY_SIZE(sSwitchGroupsLevelControlSubCommands));
591592
sShellSwitchGroupsColorControlSubCommands.RegisterCommands(sSwitchGroupsColorControlSubCommands,
592-
ArraySize(sSwitchGroupsColorControlSubCommands));
593+
MATTER_ARRAY_SIZE(sSwitchGroupsColorControlSubCommands));
593594
sShellSwitchGroupsThermostatSubCommands.RegisterCommands(sSwitchGroupsThermostatSubCommands,
594-
ArraySize(sSwitchGroupsThermostatSubCommands));
595+
MATTER_ARRAY_SIZE(sSwitchGroupsThermostatSubCommands));
595596

596597
// Register commands
597-
sShellSwitchIdentifySubCommands.RegisterCommands(sSwitchIdentifySubCommands, ArraySize(sSwitchIdentifySubCommands));
598-
sShellSwitchIdentifyReadSubCommands.RegisterCommands(sSwitchIdentifyReadSubCommands, ArraySize(sSwitchIdentifyReadSubCommands));
599-
sShellSwitchOnOffSubCommands.RegisterCommands(sSwitchOnOffSubCommands, ArraySize(sSwitchOnOffSubCommands));
600-
sShellSwitchOnOffReadSubCommands.RegisterCommands(sSwitchOnOffReadSubCommands, ArraySize(sSwitchOnOffReadSubCommands));
601-
sShellSwitchLevelControlSubCommands.RegisterCommands(sSwitchLevelControlSubCommands, ArraySize(sSwitchLevelControlSubCommands));
598+
sShellSwitchIdentifySubCommands.RegisterCommands(sSwitchIdentifySubCommands, MATTER_ARRAY_SIZE(sSwitchIdentifySubCommands));
599+
sShellSwitchIdentifyReadSubCommands.RegisterCommands(sSwitchIdentifyReadSubCommands,
600+
MATTER_ARRAY_SIZE(sSwitchIdentifyReadSubCommands));
601+
sShellSwitchOnOffSubCommands.RegisterCommands(sSwitchOnOffSubCommands, MATTER_ARRAY_SIZE(sSwitchOnOffSubCommands));
602+
sShellSwitchOnOffReadSubCommands.RegisterCommands(sSwitchOnOffReadSubCommands, MATTER_ARRAY_SIZE(sSwitchOnOffReadSubCommands));
603+
sShellSwitchLevelControlSubCommands.RegisterCommands(sSwitchLevelControlSubCommands,
604+
MATTER_ARRAY_SIZE(sSwitchLevelControlSubCommands));
602605
sShellSwitchLevelControlReadSubCommands.RegisterCommands(sSwitchLevelControlReadSubCommands,
603-
ArraySize(sSwitchLevelControlReadSubCommands));
604-
sShellSwitchColorControlSubCommands.RegisterCommands(sSwitchColorControlSubCommands, ArraySize(sSwitchColorControlSubCommands));
606+
MATTER_ARRAY_SIZE(sSwitchLevelControlReadSubCommands));
607+
sShellSwitchColorControlSubCommands.RegisterCommands(sSwitchColorControlSubCommands,
608+
MATTER_ARRAY_SIZE(sSwitchColorControlSubCommands));
605609
sShellSwitchColorControlReadSubCommands.RegisterCommands(sSwitchColorControlReadSubCommands,
606-
ArraySize(sSwitchColorControlReadSubCommands));
607-
sShellSwitchThermostatSubCommands.RegisterCommands(sSwitchThermostatSubCommands, ArraySize(sSwitchThermostatSubCommands));
610+
MATTER_ARRAY_SIZE(sSwitchColorControlReadSubCommands));
611+
sShellSwitchThermostatSubCommands.RegisterCommands(sSwitchThermostatSubCommands,
612+
MATTER_ARRAY_SIZE(sSwitchThermostatSubCommands));
608613
sShellSwitchThermostatReadSubCommands.RegisterCommands(sSwitchThermostatReadSubCommands,
609-
ArraySize(sSwitchThermostatReadSubCommands));
610-
sShellSwitchGroupsSubCommands.RegisterCommands(sSwitchGroupsSubCommands, ArraySize(sSwitchGroupsSubCommands));
611-
sShellSwitchBindingSubCommands.RegisterCommands(sSwitchBindingSubCommands, ArraySize(sSwitchBindingSubCommands));
612-
sShellSwitchSubCommands.RegisterCommands(sSwitchSubCommands, ArraySize(sSwitchSubCommands));
614+
MATTER_ARRAY_SIZE(sSwitchThermostatReadSubCommands));
615+
sShellSwitchGroupsSubCommands.RegisterCommands(sSwitchGroupsSubCommands, MATTER_ARRAY_SIZE(sSwitchGroupsSubCommands));
616+
sShellSwitchBindingSubCommands.RegisterCommands(sSwitchBindingSubCommands, MATTER_ARRAY_SIZE(sSwitchBindingSubCommands));
617+
sShellSwitchSubCommands.RegisterCommands(sSwitchSubCommands, MATTER_ARRAY_SIZE(sSwitchSubCommands));
613618

614619
Engine::Root().RegisterCommands(&sSwitchCommand, 1);
615620
}

examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp

+12-10
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,22 @@ static void RegisterManualOperationCommands()
136136
"Manual Operation commands. Usage: manual <subcommand>" };
137137

138138
// Register commands
139-
sShellManualOperationSubCommands.RegisterCommands(sManualOperationSubCommands, ArraySize(sManualOperationSubCommands));
139+
sShellManualOperationSubCommands.RegisterCommands(sManualOperationSubCommands, MATTER_ARRAY_SIZE(sManualOperationSubCommands));
140140
sShellManualOperationalStateSubCommands.RegisterCommands(sManualOperationalStateSubCommands,
141-
ArraySize(sManualOperationalStateSubCommands));
142-
sShellManualRVCSubCommands.RegisterCommands(sManualRVCSubCommands, ArraySize(sManualRVCSubCommands));
141+
MATTER_ARRAY_SIZE(sManualOperationalStateSubCommands));
142+
sShellManualRVCSubCommands.RegisterCommands(sManualRVCSubCommands, MATTER_ARRAY_SIZE(sManualRVCSubCommands));
143143
sShellManualRVCOperationalStateSubCommands.RegisterCommands(sManualRVCOperationalStateSubCommands,
144-
ArraySize(sManualRVCOperationalStateSubCommands));
145-
sShellManualRVCRunModeSubCommands.RegisterCommands(sManualRVCRunModeSubCommands, ArraySize(sManualRVCRunModeSubCommands));
146-
sShellManualRVCCleanModeSubCommands.RegisterCommands(sManualRVCCleanModeSubCommands, ArraySize(sManualRVCCleanModeSubCommands));
144+
MATTER_ARRAY_SIZE(sManualRVCOperationalStateSubCommands));
145+
sShellManualRVCRunModeSubCommands.RegisterCommands(sManualRVCRunModeSubCommands,
146+
MATTER_ARRAY_SIZE(sManualRVCRunModeSubCommands));
147+
sShellManualRVCCleanModeSubCommands.RegisterCommands(sManualRVCCleanModeSubCommands,
148+
MATTER_ARRAY_SIZE(sManualRVCCleanModeSubCommands));
147149
sShellManualRefrigeratorAlarmStateSubCommands.RegisterCommands(sManualRefrigeratorAlarmStateSubCommands,
148-
ArraySize(sManualRefrigeratorAlarmStateSubCommands));
150+
MATTER_ARRAY_SIZE(sManualRefrigeratorAlarmStateSubCommands));
149151
sShellManualDishWasherAlarmStateSubCommands.RegisterCommands(sManualDishWasherAlarmSubCommands,
150-
ArraySize(sManualDishWasherAlarmSubCommands));
151-
sShellManualOvenCavityOperationalStateSubCommands.RegisterCommands(sManualOvenCavityOperationalStateSubCommands,
152-
ArraySize(sManualOvenCavityOperationalStateSubCommands));
152+
MATTER_ARRAY_SIZE(sManualDishWasherAlarmSubCommands));
153+
sShellManualOvenCavityOperationalStateSubCommands.RegisterCommands(
154+
sManualOvenCavityOperationalStateSubCommands, MATTER_ARRAY_SIZE(sManualOvenCavityOperationalStateSubCommands));
153155

154156
Engine::Root().RegisterCommands(&sManualOperationCommand, 1);
155157
}

examples/all-clusters-app/esp32/main/ShellCommands.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void OnOffCommands::Register()
2626
static const shell_command_t subCommands[] = { { &OnLightHandler, "on", "Usage: OnOff on endpoint-id" },
2727
{ &OffLightHandler, "off", "Usage: OnOff off endpoint-id" },
2828
{ &ToggleLightHandler, "toggle", "Usage: OnOff toggle endpoint-id" } };
29-
sSubShell.RegisterCommands(subCommands, ArraySize(subCommands));
29+
sSubShell.RegisterCommands(subCommands, MATTER_ARRAY_SIZE(subCommands));
3030

3131
// Register the root `OnOff` command in the top-level shell.
3232
static const shell_command_t onOffCommand = { &OnOffHandler, "OnOff", "OnOff commands" };
@@ -43,7 +43,7 @@ void CASECommands::Register()
4343
static const shell_command_t subCommands[] = {
4444
{ &ConnectToNodeHandler, "connect", "Establish CASESession to a node, Usage: case connect <fabric-index> <node-id>" },
4545
};
46-
sSubShell.RegisterCommands(subCommands, ArraySize(subCommands));
46+
sSubShell.RegisterCommands(subCommands, MATTER_ARRAY_SIZE(subCommands));
4747

4848
static const shell_command_t CASECommand = { &CASEHandler, "case", "Case Commands" };
4949
Engine::Root().RegisterCommands(&CASECommand, 1);

0 commit comments

Comments
 (0)