Skip to content

Commit

Permalink
[kvs] replace checkexist with deletekey (#28513)
Browse files Browse the repository at this point in the history
- checkexist doesnt work on certain keys
- just use deletekey which will search for the key and delete it if found
  • Loading branch information
pankore authored Aug 8, 2023
1 parent 40f39f7 commit 0342ae4
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/platform/Ameba/KeyValueStoreManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value,
goto exit;
}

if (checkExist(key, key))
{
error = deleteKey(key, key);
err = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old kvs value");
}
}

deleteKey(key, key); // delete key if it exists
error = setPref_new(key, key, (uint8_t *) value, value_size);
err = AmebaUtils::MapError(error, AmebaErrorType::kDctError);

Expand Down

0 comments on commit 0342ae4

Please sign in to comment.