update platform_config

This commit is contained in:
Philippe G
2020-08-03 13:46:25 -07:00
parent d092bd21c1
commit fcfa8470b2
2 changed files with 13 additions and 0 deletions

View File

@@ -611,9 +611,21 @@ void config_delete_key(const char *key){
}
config_unlock();
}
void * config_alloc_get(nvs_type_t nvs_type, const char *key) {
return config_alloc_get_default(nvs_type, key, NULL, 0);
}
void * config_alloc_get_str(const char *key, char *lead, char *fallback) {
if (lead && *lead) return strdup(lead);
char *value = config_alloc_get_default(NVS_TYPE_STR, key, NULL, 0);
if ((!value || !*value) && fallback) {
if (value) free(value);
value = strdup(fallback);
}
return value;
}
void * config_alloc_get_default(nvs_type_t nvs_type, const char *key, void * default_value, size_t blob_size) {
void * value = NULL;