Code

store: Added sdb_store_clear().
authorSebastian Harl <sh@tokkee.org>
Fri, 21 Feb 2014 00:52:43 +0000 (01:52 +0100)
committerSebastian Harl <sh@tokkee.org>
Fri, 21 Feb 2014 00:52:43 +0000 (01:52 +0100)
This function clears the entire store removing all entries. It's mostly
useful for testing, I suppose.

src/core/store.c
src/include/core/store.h

index 652b24b33c738b2dba3ff5a91c08f0c9d56eb645..22e177ca8f95d4a1246f443b73f0457f48678f2f 100644 (file)
@@ -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)
 {
index 100aadf260700bdbb0c77f59c16cfedd0ca50048..f2e210da1723eda40e62f5b7ef2d086ba26d00e5 100644 (file)
@@ -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