settings: add delete key-value pair API

So far to deleting av existing key-value pair it was
required to storing NULL value using setting_save_one().
This patch introduce more intuitive API which takes only
the name key string.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2018-12-06 15:02:06 +01:00 committed by Carles Cufí
commit cb92c95aab
2 changed files with 17 additions and 0 deletions

View file

@ -139,6 +139,18 @@ int settings_save(void);
*/
int settings_save_one(const char *name, void *value, size_t val_len);
/**
* Delete a single serialized in persisted storage.
*
* Deleting an existing key-value pair in the settings mean
* to set its value to NULL.
*
* @param name Name/key of the settings item.
*
* @return 0 on success, non-zero on failure.
*/
int settings_delete(const char *name);
/**
* Set settings item identified by @p name to be value @p value.
* This finds the settings handler for this subtree and calls it's