Skip to content

Commit

Permalink
Modernize use nullptr (project-chip#17113)
Browse files Browse the repository at this point in the history
* Enable modernize-use-nullptr clang-tidy.

Ran clang-tidy and updated like:

```
./scripts/run-clang-tidy-on-compile-commands.py --compile-database
out/linux-x64-tests/compile_commands.json fix
```

May need more passes for darwin if CI on darwin fails.

* Restyle

* More nullptr fixes

* Update zap template from NULL to nullptr
  • Loading branch information
andy31415 authored Apr 6, 2022
1 parent 93f42ca commit 697b155
Show file tree
Hide file tree
Showing 39 changed files with 855 additions and 854 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
Checks: 'bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion'
Checks: 'modernize-use-nullptr,bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion'
WarningsAsErrors: '*'
HeaderFilterRegex: '(src|examples|zzz_generated|credentials)'
6 changes: 3 additions & 3 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, uint16_t deviceTyp
uint8_t index = 0;
while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
{
if (NULL == gDevices[index])
if (nullptr == gDevices[index])
{
gDevices[index] = dev;
EmberAfStatus ret;
Expand Down Expand Up @@ -246,7 +246,7 @@ int RemoveDeviceEndpoint(Device * dev)
if (gDevices[index] == dev)
{
EndpointId ep = emberAfClearDynamicEndpoint(index);
gDevices[index] = NULL;
gDevices[index] = nullptr;
ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index);
// Silence complaints about unused ep when progress logging
// disabled.
Expand Down Expand Up @@ -482,7 +482,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI

EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE;

if ((endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) && (gDevices[endpointIndex] != NULL))
if ((endpointIndex < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) && (gDevices[endpointIndex] != nullptr))
{
Device * dev = gDevices[endpointIndex];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void CHIPSetDomainValueForKey(NSString * domain, NSString * key, id value)

void CHIPRemoveDomainValueForKey(NSString * domain, NSString * key)
{
CFPreferencesSetAppValue((CFStringRef) key, NULL, (CFStringRef) domain);
CFPreferencesSetAppValue((CFStringRef) key, nullptr, (CFStringRef) domain);
CFPreferencesAppSynchronize((CFStringRef) domain);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (SecKeyRef)pubkey
(NSString *) kSecAttrLabel : kCHIPToolKeychainLabel,
(NSString *) kSecAttrApplicationTag : @CHIPPlugin_CAKeyTag,
};
return SecKeyCreateWithData((__bridge CFDataRef) publicKeyNSData, (__bridge CFDictionaryRef) attributes, NULL);
return SecKeyCreateWithData((__bridge CFDataRef) publicKeyNSData, (__bridge CFDictionaryRef) attributes, nullptr);
}

- (CHIP_ERROR)Deserialize:(chip::Crypto::P256SerializedKeypair &)input
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool-darwin/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public:
[cluster subscribe{{>attribute}}WithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval]
maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval]
params:params
subscriptionEstablished: NULL reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) {
subscriptionEstablished: nullptr reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) {
NSLog(@"{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} response %@", [value description]);
if (error || !mWait){
SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool InteractiveStartCommand::ParseCommand(char * command)
}

args[argsCount++] = token;
token = strtok(NULL, " ");
token = strtok(nullptr, " ");
}

ClearLine();
Expand Down
6 changes: 3 additions & 3 deletions examples/shell/shell_common/cmd_ping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Transport::PeerAddress GetEchoPeerAddress()

void Shutdown()
{
chip::DeviceLayer::SystemLayer().CancelTimer(EchoTimerHandler, NULL);
chip::DeviceLayer::SystemLayer().CancelTimer(EchoTimerHandler, nullptr);
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
if (gPingArguments.IsUsingTCP())
{
Expand Down Expand Up @@ -212,7 +212,7 @@ CHIP_ERROR SendEchoRequest(streamer_t * stream)

gPingArguments.SetLastEchoTime(System::SystemClock().GetMonotonicTimestamp());
SuccessOrExit(chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(gPingArguments.GetEchoInterval()),
EchoTimerHandler, NULL));
EchoTimerHandler, nullptr));

streamer_printf(stream, "\nSend echo request message with payload size: %d bytes to Node: %" PRIu64 "\n", payloadSize,
kTestDeviceNodeId);
Expand All @@ -226,7 +226,7 @@ CHIP_ERROR SendEchoRequest(streamer_t * stream)
}
else
{
chip::DeviceLayer::SystemLayer().CancelTimer(EchoTimerHandler, NULL);
chip::DeviceLayer::SystemLayer().CancelTimer(EchoTimerHandler, nullptr);
}

exit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Delegate * gDelegateTable[kAudioOutputDelegateTableSize] = { nullptr };
Delegate * GetDelegate(EndpointId endpoint)
{
uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::AudioOutput::Id);
return (ep == 0xFFFF ? NULL : gDelegateTable[ep]);
return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]);
}

bool isDelegateNull(Delegate * delegate, EndpointId endpoint)
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ias-zone-server/ias-zone-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ MatterIasZoneClusterServerPreAttributeChangedCallback(const app::ConcreteAttribu

// If this is not a CIE Address write, the CIE address has already been
// written, or the IAS Zone server is already enrolled, do nothing.
if (attributePath.mAttributeId != ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID || emberAfCurrentCommand() == NULL)
if (attributePath.mAttributeId != ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID || emberAfCurrentCommand() == nullptr)
{
return Protocols::InteractionModel::Status::Success;
}
Expand Down
16 changes: 8 additions & 8 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void deactivate(EndpointId endpoint)
static EmberAfLevelControlState * getState(EndpointId endpoint)
{
uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, LevelControl::Id);
return (ep == 0xFFFF ? NULL : &stateTable[ep]);
return (ep == 0xFFFF ? nullptr : &stateTable[ep]);
}

#if !defined(IGNORE_LEVEL_CONTROL_CLUSTER_OPTIONS) && defined(EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP)
Expand Down Expand Up @@ -172,7 +172,7 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint)
EmberAfStatus status;
uint8_t currentLevel;

if (state == NULL)
if (state == nullptr)
{
return;
}
Expand Down Expand Up @@ -515,7 +515,7 @@ static EmberAfStatus moveToLevelHandler(EndpointId endpoint, CommandId commandId
uint8_t currentLevel;
uint8_t actualStepSize;

if (state == NULL)
if (state == nullptr)
{
return EMBER_ZCL_STATUS_FAILURE;
}
Expand Down Expand Up @@ -649,7 +649,7 @@ static void moveHandler(CommandId commandId, uint8_t moveMode, uint8_t rate, uin
uint8_t currentLevel;
uint8_t difference;

if (state == NULL)
if (state == nullptr)
{
status = EMBER_ZCL_STATUS_FAILURE;
goto send_default_response;
Expand Down Expand Up @@ -762,7 +762,7 @@ static void stepHandler(CommandId commandId, uint8_t stepMode, uint8_t stepSize,
uint8_t currentLevel;
uint8_t actualStepSize = stepSize;

if (state == NULL)
if (state == nullptr)
{
status = EMBER_ZCL_STATUS_FAILURE;
goto send_default_response;
Expand Down Expand Up @@ -881,7 +881,7 @@ static void stopHandler(CommandId commandId, uint8_t optionMask, uint8_t optionO
EmberAfLevelControlState * state = getState(endpoint);
EmberAfStatus status;

if (state == NULL)
if (state == nullptr)
{
status = EMBER_ZCL_STATUS_FAILURE;
goto send_default_response;
Expand Down Expand Up @@ -912,7 +912,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new
EmberAfStatus status;

EmberAfLevelControlState * state = getState(endpoint);
if (state == NULL)
if (state == nullptr)
{
emberAfLevelControlClusterPrintln("ERR: Level control cluster not available on ep%d", endpoint);
return;
Expand Down Expand Up @@ -1006,7 +1006,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint)
{
EmberAfLevelControlState * state = getState(endpoint);

if (state == NULL)
if (state == nullptr)
{
emberAfLevelControlClusterPrintln("ERR: Level control cluster not available on ep%d", endpoint);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/low-power-server/low-power-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Delegate * gDelegateTable[kLowPowerDelegateTableSize] = { nullptr };
Delegate * GetDelegate(EndpointId endpoint)
{
uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::LowPower::Id);
return (ep == 0xFFFF ? NULL : gDelegateTable[ep]);
return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]);
}

bool isDelegateNull(Delegate * delegate, EndpointId endpoint)
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/media-input-server/media-input-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Delegate * gDelegateTable[kMediaInputDelegateTableSize] = { nullptr };
Delegate * GetDelegate(EndpointId endpoint)
{
uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::MediaInput::Id);
return (ep == 0xFFFF ? NULL : gDelegateTable[ep]);
return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]);
}

bool isDelegateNull(Delegate * delegate, EndpointId endpoint)
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ota-provider/ota-provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ OTAProviderDelegate * gDelegateTable[kOtaProviderDelegateTableSize] = { nullptr
OTAProviderDelegate * GetDelegate(EndpointId endpoint)
{
uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, OtaSoftwareUpdateProvider::Id);
return (ep == 0xFFFF ? NULL : gDelegateTable[ep]);
return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]);
}

bool SendStatusIfDelegateNull(app::CommandHandler * commandObj, const app::ConcreteCommandPath & path)
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/wake-on-lan-server/wake-on-lan-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Delegate * gDelegateTable[kWakeOnLanDelegateTableSize] = { nullptr };
Delegate * GetDelegate(EndpointId endpoint)
{
uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::WakeOnLan::Id);
return (ep == 0xFFFF ? NULL : gDelegateTable[ep]);
return (ep == 0xFFFF ? nullptr : gDelegateTable[ep]);
}

bool isDelegateNull(Delegate * delegate, EndpointId endpoint)
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/TestNumericAttributeTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ nlTestSuite theSuite =

int TestNumericAttributeTraits()
{
nlTestRunner(&theSuite, NULL);
nlTestRunner(&theSuite, nullptr);
return (nlTestRunnerStats(&theSuite));
}

Expand Down
19 changes: 10 additions & 9 deletions src/app/tests/integration/chip_im_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,12 @@ void CommandRequestTimerHandler(chip::System::Layer * systemLayer, void * appSta
err = SendCommandRequest(std::move(commandSender));
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to send command request with error: %s\n", chip::ErrorStr(err)));

err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, CommandRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, CommandRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}
else
{
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, BadCommandRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, BadCommandRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}

Expand All @@ -506,7 +506,7 @@ void BadCommandRequestTimerHandler(chip::System::Layer * systemLayer, void * app
err = SendBadCommandRequest(std::move(commandSender));
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to send bad command request with error: %s\n", chip::ErrorStr(err)));

err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, ReadRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, ReadRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));

exit:
Expand All @@ -533,12 +533,12 @@ void ReadRequestTimerHandler(chip::System::Layer * systemLayer, void * appState)
err = SendReadRequest();
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to send read request with error: %s\n", chip::ErrorStr(err)));

err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, ReadRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, ReadRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}
else
{
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, WriteRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, WriteRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}

Expand Down Expand Up @@ -570,12 +570,12 @@ void WriteRequestTimerHandler(chip::System::Layer * systemLayer, void * appState
err = SendWriteRequest(writeClient);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to send write request with error: %s\n", chip::ErrorStr(err)));

err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, WriteRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gMessageInterval, WriteRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}
else
{
err = chip::DeviceLayer::SystemLayer().StartTimer(gSubscribeRequestMessageTimeout, SubscribeRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(gSubscribeRequestMessageTimeout, SubscribeRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}

Expand Down Expand Up @@ -603,7 +603,8 @@ void SubscribeRequestTimerHandler(chip::System::Layer * systemLayer, void * appS
err = SendSubscribeRequest();
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to send write request with error: %s\n", chip::ErrorStr(err)));

err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(20), SubscribeRequestTimerHandler, NULL);
err =
chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(20), SubscribeRequestTimerHandler, nullptr);
VerifyOrExit(err == CHIP_NO_ERROR, printf("Failed to schedule timer with error: %s\n", chip::ErrorStr(err)));
}
else
Expand Down Expand Up @@ -730,7 +731,7 @@ int main(int argc, char * argv[])
err = EstablishSecureSession();
SuccessOrExit(err);

err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::kZero, CommandRequestTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::kZero, CommandRequestTimerHandler, nullptr);
SuccessOrExit(err);

chip::DeviceLayer::PlatformMgr().RunEventLoop();
Expand Down
8 changes: 4 additions & 4 deletions src/ble/tests/TestBleErrorStr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ static void CheckBleErrorStr(nlTestSuite * inSuite, void * inContext)

// Assert that the error string contains the error number in hex.
snprintf(expectedText, sizeof(expectedText), "%08" PRIX32, err.AsInteger());
NL_TEST_ASSERT(inSuite, (strstr(errStr, expectedText) != NULL));
NL_TEST_ASSERT(inSuite, (strstr(errStr, expectedText) != nullptr));

#if !CHIP_CONFIG_SHORT_ERROR_STR
// Assert that the error string contains a description, which is signaled
// by a presence of a colon proceeding the description.
NL_TEST_ASSERT(inSuite, (strchr(errStr, ':') != NULL));
NL_TEST_ASSERT(inSuite, (strchr(errStr, ':') != nullptr));
#endif // !CHIP_CONFIG_SHORT_ERROR_STR
}
}
Expand All @@ -120,8 +120,8 @@ int TestBleErrorStr(void)
{
"Ble-Error-Strings",
&sTests[0],
NULL,
NULL
nullptr,
nullptr
};
// clang-format on

Expand Down
2 changes: 1 addition & 1 deletion src/ble/tests/TestBleUUID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const nlTest sTests[] =

int TestBleUUID()
{
nlTestSuite theSuite = { "BleUUID", &sTests[0], NULL, NULL };
nlTestSuite theSuite = { "BleUUID", &sTests[0], nullptr, nullptr };
nlTestRunner(&theSuite, nullptr);
return nlTestRunnerStats(&theSuite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ ChipError::StorageType
pychip_CommissionableNodeController_NewController(chip::Controller::CommissionableNodeController ** outCommissionableNodeCtrl)
{
*outCommissionableNodeCtrl = new chip::Controller::CommissionableNodeController();
VerifyOrReturnError(*outCommissionableNodeCtrl != NULL, CHIP_ERROR_NO_MEMORY.AsInteger());
VerifyOrReturnError(*outCommissionableNodeCtrl != nullptr, CHIP_ERROR_NO_MEMORY.AsInteger());
return CHIP_NO_ERROR.AsInteger();
}

ChipError::StorageType
pychip_CommissionableNodeController_DeleteController(chip::Controller::CommissionableNodeController * commissionableNodeCtrl)
{
if (commissionableNodeCtrl != NULL)
if (commissionableNodeCtrl != nullptr)
{
delete commissionableNodeCtrl;
}
Expand Down
Loading

0 comments on commit 697b155

Please sign in to comment.