Started implementing backing managment

This commit is contained in:
2024-02-17 13:01:40 +01:00
parent 36a1faf948
commit fd7b056457
4 changed files with 115 additions and 4 deletions

View File

@@ -304,6 +304,27 @@ Result list_entries(char*** out_entries) {
return SUCCESS;
}
Result clear_entries(void) {
char** entries;
Result result = list_entries(&entries);
if (result != SUCCESS)
return result;
// Remove each entry
for (int i = 0; entries[i] != NULL; i++) {
result = remove_entry(entries[i]);
if (result != SUCCESS)
log_message(LOG_LEVEL_WARNING, "Failed to remove the entry '%s'.", entries[i]);
}
// Free the entries
for (int i = 0; entries[i] != NULL; i++)
free(entries[i]);
free(entries);
return SUCCESS;
}
Result reset_entry(const char* entry_id) {
// Check that it exists
bool exists;