summaryrefslogtreecommitdiff
path: root/src/bin/e_datastore.c
blob: d9676a239a0aa0a87b2d5a3d48a01db819c393c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#include "e.h"

/* local subsystem functions */

/* local subsystem globals */
static Eina_Hash *store = NULL;

/* externally accessible functions */
EAPI void
e_datastore_set(char *key, void *data)
{
   if (!store) store = eina_hash_string_superfast_new(NULL);
   eina_hash_del(store, key, NULL);
   eina_hash_add(store, key, data);
}

EAPI void *
e_datastore_get(char *key)
{
   return eina_hash_find(store, key);
}

EAPI void
e_datastore_del(char *key)
{
   eina_hash_del(store, key, NULL);
   if (eina_hash_population(store)) return;
   eina_hash_free(store);
   store = NULL;
}

/* local subsystem functions */