From 0302f192079785410cc686bdda94e1522f38d5d8 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 18 Apr 2024 15:44:50 -0400 Subject: [PATCH 1/4] Convert some chip::Optional to std::optional --- src/app/CommandHandler.cpp | 24 +++++++-------- src/app/CommandHandler.h | 2 +- src/app/CommandPathRegistry.h | 28 +++++++++-------- .../tests/TestBasicCommandPathRegistry.cpp | 16 +++++----- src/app/tests/TestCommandInteraction.cpp | 30 ++++++++++--------- src/lib/core/Optional.h | 10 +++++++ 6 files changed, 62 insertions(+), 48 deletions(-) diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 901cc658580749..88bbb78270c8f1 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -158,7 +158,7 @@ CHIP_ERROR CommandHandler::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRe // Grab the CommandRef if there is one, and validate that it's there when it // has to be. - Optional commandRef; + std::optional commandRef; uint16_t ref; err = commandData.GetRef(&ref); VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_END_OF_TLV, err); @@ -168,7 +168,7 @@ CHIP_ERROR CommandHandler::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRe } if (err == CHIP_NO_ERROR) { - commandRef.SetValue(ref); + commandRef.emplace(ref); } // Adding can fail if concretePath is not unique, or if commandRef is a value @@ -590,9 +590,9 @@ CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const ConcreteCommandPat const CommandHandler::InvokeResponseParameters & aPrepareParameters) { auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); - VerifyOrReturnValue(commandPathRegistryEntry.HasValue(), CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - return PrepareInvokeResponseCommand(commandPathRegistryEntry.Value(), aResponseCommandPath, + return PrepareInvokeResponseCommand(commandPathRegistryEntry.value(), aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); } @@ -610,9 +610,9 @@ CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aResponseC "Seemingly device supports batch commands, but is calling the deprecated PrepareCommand API"); auto commandPathRegistryEntry = GetCommandPathRegistry().GetFirstEntry(); - VerifyOrReturnValue(commandPathRegistryEntry.HasValue(), CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - return PrepareInvokeResponseCommand(commandPathRegistryEntry.Value(), aResponseCommandPath, aStartDataStruct); + return PrepareInvokeResponseCommand(commandPathRegistryEntry.value(), aResponseCommandPath, aStartDataStruct); } CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, @@ -675,9 +675,9 @@ CHIP_ERROR CommandHandler::FinishCommand(bool aStartDataStruct) ReturnErrorOnFailure(commandData.GetWriter()->EndContainer(mDataElementContainerType)); } - if (mRefForResponse.HasValue()) + if (mRefForResponse.has_value()) { - ReturnErrorOnFailure(commandData.Ref(mRefForResponse.Value())); + ReturnErrorOnFailure(commandData.Ref(mRefForResponse.value())); } ReturnErrorOnFailure(commandData.EndOfCommandDataIB()); @@ -699,8 +699,8 @@ CHIP_ERROR CommandHandler::PrepareStatus(const ConcreteCommandPath & aCommandPat } auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aCommandPath); - VerifyOrReturnError(commandPathRegistryEntry.HasValue(), CHIP_ERROR_INCORRECT_STATE); - mRefForResponse = commandPathRegistryEntry.Value().ref; + VerifyOrReturnError(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); + mRefForResponse = commandPathRegistryEntry.value().ref; MoveToState(State::Preparing); InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); @@ -720,9 +720,9 @@ CHIP_ERROR CommandHandler::FinishStatus() VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); - if (mRefForResponse.HasValue()) + if (mRefForResponse.has_value()) { - ReturnErrorOnFailure(commandStatus.Ref(mRefForResponse.Value())); + ReturnErrorOnFailure(commandStatus.Ref(mRefForResponse.value())); } ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB()); diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index e31edfd444c629..2eed73daccdda9 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -686,7 +686,7 @@ class CommandHandler // TODO Allow flexibility in registration. BasicCommandPathRegistry mBasicCommandPathRegistry; CommandPathRegistry * mCommandPathRegistry = &mBasicCommandPathRegistry; - Optional mRefForResponse; + std::optional mRefForResponse; CommandHandlerExchangeInterface * mpResponder = nullptr; diff --git a/src/app/CommandPathRegistry.h b/src/app/CommandPathRegistry.h index 0d914ef1de3348..da0d16e1f69109 100644 --- a/src/app/CommandPathRegistry.h +++ b/src/app/CommandPathRegistry.h @@ -24,13 +24,15 @@ #include #include +#include + namespace chip { namespace app { struct CommandPathRegistryEntry { ConcreteCommandPath requestPath = ConcreteCommandPath(0, 0, 0); - Optional ref; + std::optional ref; }; class CommandPathRegistry @@ -38,11 +40,11 @@ class CommandPathRegistry public: virtual ~CommandPathRegistry() = default; - virtual Optional Find(const ConcreteCommandPath & requestPath) const = 0; - virtual Optional GetFirstEntry() const = 0; - virtual CHIP_ERROR Add(const ConcreteCommandPath & requestPath, const Optional & ref) = 0; - virtual size_t Count() const = 0; - virtual size_t MaxSize() const = 0; + virtual std::optional Find(const ConcreteCommandPath & requestPath) const = 0; + virtual std::optional GetFirstEntry() const = 0; + virtual CHIP_ERROR Add(const ConcreteCommandPath & requestPath, const std::optional & ref) = 0; + virtual size_t Count() const = 0; + virtual size_t MaxSize() const = 0; }; /** @@ -59,28 +61,28 @@ template class BasicCommandPathRegistry : public CommandPathRegistry { public: - Optional Find(const ConcreteCommandPath & requestPath) const override + std::optional Find(const ConcreteCommandPath & requestPath) const override { for (size_t i = 0; i < mCount; i++) { if (mTable[i].requestPath == requestPath) { - return MakeOptional(mTable[i]); + return std::make_optional(mTable[i]); } } - return NullOptional; + return std::nullopt; } - Optional GetFirstEntry() const override + std::optional GetFirstEntry() const override { if (mCount > 0) { - return MakeOptional(mTable[0]); + return std::make_optional(mTable[0]); } - return NullOptional; + return std::nullopt; } - CHIP_ERROR Add(const ConcreteCommandPath & requestPath, const Optional & ref) override + CHIP_ERROR Add(const ConcreteCommandPath & requestPath, const std::optional & ref) override { if (mCount >= N) { diff --git a/src/app/tests/TestBasicCommandPathRegistry.cpp b/src/app/tests/TestBasicCommandPathRegistry.cpp index 61e859b95498f0..28d7621ccbe7d1 100644 --- a/src/app/tests/TestBasicCommandPathRegistry.cpp +++ b/src/app/tests/TestBasicCommandPathRegistry.cpp @@ -36,13 +36,13 @@ void TestAddingSameConcretePath(nlTestSuite * apSuite, void * apContext) BasicCommandPathRegistry basicCommandPathRegistry; ConcreteCommandPath concretePath(0, 0, 0); - Optional commandRef; + std::optional commandRef; uint16_t commandRefValue = 0; size_t idx = 0; for (idx = 0; idx < kQuickTestSize && err == CHIP_NO_ERROR; idx++) { - commandRef.SetValue(commandRefValue); + commandRef.emplace(commandRefValue); commandRefValue++; err = basicCommandPathRegistry.Add(concretePath, commandRef); } @@ -56,8 +56,8 @@ void TestAddingSameCommandRef(nlTestSuite * apSuite, void * apContext) CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; - Optional commandRef; - commandRef.SetValue(0); + std::optional commandRef; + commandRef.emplace(0); uint16_t endpointValue = 0; @@ -78,14 +78,14 @@ void TestAddingMaxNumberOfEntries(nlTestSuite * apSuite, void * apContext) CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; - Optional commandRef; + std::optional commandRef; uint16_t commandRefAndEndpointValue = 0; size_t idx = 0; for (idx = 0; idx < kQuickTestSize && err == CHIP_NO_ERROR; idx++) { ConcreteCommandPath concretePath(commandRefAndEndpointValue, 0, 0); - commandRef.SetValue(commandRefAndEndpointValue); + commandRef.emplace(commandRefAndEndpointValue); commandRefAndEndpointValue++; err = basicCommandPathRegistry.Add(concretePath, commandRef); } @@ -100,14 +100,14 @@ void TestAddingTooManyEntries(nlTestSuite * apSuite, void * apContext) BasicCommandPathRegistry basicCommandPathRegistry; size_t maxPlusOne = kQuickTestSize + 1; - Optional commandRef; + std::optional commandRef; uint16_t commandRefAndEndpointValue = 0; size_t idx = 0; for (idx = 0; idx < maxPlusOne && err == CHIP_NO_ERROR; idx++) { ConcreteCommandPath concretePath(commandRefAndEndpointValue, 0, 0); - commandRef.SetValue(commandRefAndEndpointValue); + commandRef.emplace(commandRefAndEndpointValue); commandRefAndEndpointValue++; err = basicCommandPathRegistry.Add(concretePath, commandRef); } diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index 9837818862c21b..b40d4c787f5c72 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -392,7 +393,7 @@ class TestCommandInteraction const Optional & aRef) : CommandHandler(apCallback) { - GetCommandPathRegistry().Add(aRequestCommandPath, aRef); + GetCommandPathRegistry().Add(aRequestCommandPath, aRef.std_optional()); SetExchangeInterface(&mMockCommandResponder); } MockCommandResponder mMockCommandResponder; @@ -407,7 +408,8 @@ class TestCommandInteraction // payload will be included. Otherwise no payload will be included. static void GenerateInvokeResponse(nlTestSuite * apSuite, void * apContext, System::PacketBufferHandle & aPayload, CommandId aCommandId, ClusterId aClusterId = kTestClusterId, - EndpointId aEndpointId = kTestEndpointId, Optional aCommandRef = NullOptional); + EndpointId aEndpointId = kTestEndpointId, + std::optional aCommandRef = std::nullopt); static void AddInvokeRequestData(nlTestSuite * apSuite, void * apContext, CommandSender * apCommandSender, CommandId aCommandId = kTestCommandIdWithData); static void AddInvalidInvokeRequestData(nlTestSuite * apSuite, void * apContext, CommandSender * apCommandSender, @@ -494,7 +496,7 @@ void TestCommandInteraction::GenerateInvokeRequest(nlTestSuite * apSuite, void * void TestCommandInteraction::GenerateInvokeResponse(nlTestSuite * apSuite, void * apContext, System::PacketBufferHandle & aPayload, CommandId aCommandId, ClusterId aClusterId, EndpointId aEndpointId, - Optional aCommandRef) + std::optional aCommandRef) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -536,9 +538,9 @@ void TestCommandInteraction::GenerateInvokeResponse(nlTestSuite * apSuite, void NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } - if (aCommandRef.HasValue()) + if (aCommandRef.has_value()) { - NL_TEST_ASSERT(apSuite, commandDataIBBuilder.Ref(aCommandRef.Value()) == CHIP_NO_ERROR); + NL_TEST_ASSERT(apSuite, commandDataIBBuilder.Ref(aCommandRef.value()) == CHIP_NO_ERROR); } commandDataIBBuilder.EndOfCommandDataIB(); @@ -633,9 +635,9 @@ uint32_t TestCommandInteraction::GetAddResponseDataOverheadSizeForPath(nlTestSui ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; - CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, MakeOptional(static_cast(1))); + CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, std::make_optional(static_cast(1))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = basicCommandPathRegistry.Add(requestCommandPath2, MakeOptional(static_cast(2))); + err = basicCommandPathRegistry.Add(requestCommandPath2, std::make_optional(static_cast(2))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = commandHandler.AllocateBuffer(); @@ -823,7 +825,7 @@ void TestCommandInteraction::TestCommandSenderExtendableApiWithProcessReceivedMs uint16_t invalidResponseCommandRef = 2; GenerateInvokeResponse(apSuite, apContext, buf, kTestCommandIdWithData, kTestClusterId, kTestEndpointId, - MakeOptional(invalidResponseCommandRef)); + std::make_optional(invalidResponseCommandRef)); bool moreChunkedMessages = false; err = commandSender.ProcessInvokeResponse(std::move(buf), moreChunkedMessages); NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_KEY_NOT_FOUND); @@ -1948,9 +1950,9 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; - CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, MakeOptional(static_cast(1))); + CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, std::make_optional(static_cast(1))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = basicCommandPathRegistry.Add(requestCommandPath2, MakeOptional(static_cast(2))); + err = basicCommandPathRegistry.Add(requestCommandPath2, std::make_optional(static_cast(2))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); uint32_t sizeToLeave = 0; @@ -1977,9 +1979,9 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; - CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, MakeOptional(static_cast(1))); + CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, std::make_optional(static_cast(1))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = basicCommandPathRegistry.Add(requestCommandPath2, MakeOptional(static_cast(2))); + err = basicCommandPathRegistry.Add(requestCommandPath2, std::make_optional(static_cast(2))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); uint32_t sizeToLeave = 0; @@ -2005,9 +2007,9 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; - CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, MakeOptional(static_cast(1))); + CHIP_ERROR err = basicCommandPathRegistry.Add(requestCommandPath1, std::make_optional(static_cast(1))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = basicCommandPathRegistry.Add(requestCommandPath2, MakeOptional(static_cast(2))); + err = basicCommandPathRegistry.Add(requestCommandPath2, std::make_optional(static_cast(2))); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); uint32_t sizeToLeave = 0; diff --git a/src/lib/core/Optional.h b/src/lib/core/Optional.h index 3d509f544c97cd..3ed2dcc2b153b7 100644 --- a/src/lib/core/Optional.h +++ b/src/lib/core/Optional.h @@ -24,6 +24,7 @@ #pragma once #include +#include #include #include @@ -211,6 +212,15 @@ class Optional bool operator==(const T & other) const { return HasValue() && Value() == other; } bool operator!=(const T & other) const { return !(*this == other); } + std::optional std_optional() const + { + if (!HasValue()) + { + return std::optional(); + } + return std::make_optional(Value()); + } + /** Convenience method to create an optional without a valid value. */ static Optional Missing() { return Optional(); } From d88aafed251b62a5b91b8f60f6ec23407d09a519 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 18 Apr 2024 15:52:13 -0400 Subject: [PATCH 2/4] Use operator*/-> for optional value access after has_value has been called --- src/app/CommandHandler.cpp | 10 +++++----- src/app/tests/TestCommandInteraction.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 88bbb78270c8f1..49d49813d6dcef 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -592,7 +592,7 @@ CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const ConcreteCommandPat auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - return PrepareInvokeResponseCommand(commandPathRegistryEntry.value(), aResponseCommandPath, + return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); } @@ -612,7 +612,7 @@ CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aResponseC auto commandPathRegistryEntry = GetCommandPathRegistry().GetFirstEntry(); VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - return PrepareInvokeResponseCommand(commandPathRegistryEntry.value(), aResponseCommandPath, aStartDataStruct); + return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aStartDataStruct); } CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, @@ -677,7 +677,7 @@ CHIP_ERROR CommandHandler::FinishCommand(bool aStartDataStruct) if (mRefForResponse.has_value()) { - ReturnErrorOnFailure(commandData.Ref(mRefForResponse.value())); + ReturnErrorOnFailure(commandData.Ref(*mRefForResponse)); } ReturnErrorOnFailure(commandData.EndOfCommandDataIB()); @@ -700,7 +700,7 @@ CHIP_ERROR CommandHandler::PrepareStatus(const ConcreteCommandPath & aCommandPat auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aCommandPath); VerifyOrReturnError(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - mRefForResponse = commandPathRegistryEntry.value().ref; + mRefForResponse = commandPathRegistryEntry->ref; MoveToState(State::Preparing); InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); @@ -722,7 +722,7 @@ CHIP_ERROR CommandHandler::FinishStatus() CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); if (mRefForResponse.has_value()) { - ReturnErrorOnFailure(commandStatus.Ref(mRefForResponse.value())); + ReturnErrorOnFailure(commandStatus.Ref(*mRefForResponse)); } ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB()); diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index b40d4c787f5c72..87296580fa695f 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -540,7 +540,7 @@ void TestCommandInteraction::GenerateInvokeResponse(nlTestSuite * apSuite, void if (aCommandRef.has_value()) { - NL_TEST_ASSERT(apSuite, commandDataIBBuilder.Ref(aCommandRef.value()) == CHIP_NO_ERROR); + NL_TEST_ASSERT(apSuite, commandDataIBBuilder.Ref(*aCommandRef) == CHIP_NO_ERROR); } commandDataIBBuilder.EndOfCommandDataIB(); From 2237b8c46eee06b83ad15e668968e5cd44da848e Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 18 Apr 2024 15:55:28 -0400 Subject: [PATCH 3/4] Slightly more compact code --- src/lib/core/Optional.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/core/Optional.h b/src/lib/core/Optional.h index 3ed2dcc2b153b7..8da70544967d9e 100644 --- a/src/lib/core/Optional.h +++ b/src/lib/core/Optional.h @@ -214,10 +214,7 @@ class Optional std::optional std_optional() const { - if (!HasValue()) - { - return std::optional(); - } + VerifyOrReturnValue(HasValue(), std::nullopt); return std::make_optional(Value()); } From e6df82a258701fe728574d0fd45b3463125377b9 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 18 Apr 2024 15:57:07 -0400 Subject: [PATCH 4/4] Restyle --- src/app/CommandHandler.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 49d49813d6dcef..005067c96bd7c4 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -592,8 +592,7 @@ CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const ConcreteCommandPat auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, - aPrepareParameters.mStartOrEndDataStruct); + return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); } CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aResponseCommandPath, bool aStartDataStruct)