Skip to content

Commit

Permalink
Using Charspan methods for comparison, copying
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Dec 6, 2024
1 parent 117d3b6 commit d5fa1ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/platform/silabs/tracing/SilabsTracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ CHIP_ERROR SilabsTracer::RegisterAppTimeTraceOperation(CharSpan & appOperationKe
size_t index = 0;
VerifyOrReturnError(CHIP_ERROR_NOT_FOUND == FindAppOperationIndex(appOperationKey, index), CHIP_ERROR_INVALID_ARGUMENT);

memcpy(mAppOperationKeys[mAppOperationKeyCount], appOperationKey.data(), appOperationKey.size());
MutableCharSpan newAppKey(mAppOperationKeys[mAppOperationKeyCount]);
CopyCharSpanToMutableCharSpan(appOperationKey, newAppKey);
mAppOperationKeyCount++;
return CHIP_NO_ERROR;
}
Expand All @@ -467,7 +468,8 @@ CHIP_ERROR SilabsTracer::FindAppOperationIndex(CharSpan & appOperationKey, size_
{
for (size_t i = 0; i < mAppOperationKeyCount; ++i)
{
if (strncmp(mAppOperationKeys[i], appOperationKey.data(), appOperationKey.size()) == 0)
CharSpan appKey(mAppOperationKeys[i], appOperationKey.size());
if (appKey.data_equal(appOperationKey))
{
index = i;
return CHIP_NO_ERROR;
Expand Down

0 comments on commit d5fa1ab

Please sign in to comment.