From: Sebastian Harl Date: Fri, 21 Feb 2014 00:52:43 +0000 (+0100) Subject: store: Added sdb_store_clear(). X-Git-Tag: sysdb-0.1.0~196 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=e2fbe0efeb9be4c61911a18b337dc89ca351ca81 store: Added sdb_store_clear(). This function clears the entire store removing all entries. It's mostly useful for testing, I suppose. --- diff --git a/src/core/store.c b/src/core/store.c index 652b24b..22e177c 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -390,6 +390,13 @@ store_obj_tojson(sdb_llist_t *list, int type, sdb_strbuf_t *buf) * public API */ +void +sdb_store_clear(void) +{ + sdb_llist_destroy(obj_list); + obj_list = NULL; +} /* sdb_store_clear */ + int sdb_store_host(const char *name, sdb_time_t last_update) { diff --git a/src/include/core/store.h b/src/include/core/store.h index 100aadf..f2e210d 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -49,6 +49,13 @@ extern "C" { struct sdb_store_base; typedef struct sdb_store_base sdb_store_base_t; +/* + * sdb_store_clear: + * Clear the entire store and remove all stored objects. + */ +void +sdb_store_clear(void); + /* * sdb_store_host: * Add/update a host in the store. If the host, identified by its