diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2024-07-22 23:56:08 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2024-07-22 23:56:08 +0000 |
commit | 8d5a23bf7fe6bda50bab13f12725f3b7c8976d29 (patch) | |
tree | 261fb68fe46d0fc7553b4bab72204e1ec7d1c6d0 /src/config/conftree.c | |
parent | e5cc55570c2c986c71fc75bcde93620598db7be4 (diff) | |
download | shibari-8d5a23bf7fe6bda50bab13f12725f3b7c8976d29.tar.xz |
Revamp and improve config system
Now features:
- keys can be binary blobs (useful for accept and server)
- values can be unique or accumulators
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/config/conftree.c')
-rw-r--r-- | src/config/conftree.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/config/conftree.c b/src/config/conftree.c deleted file mode 100644 index 573646a..0000000 --- a/src/config/conftree.c +++ /dev/null @@ -1,51 +0,0 @@ -/* ISC license. */ - -#include <skalibs/genalloc.h> -#include <skalibs/avltree.h> -#include <skalibs/cdbmake.h> - -#include "shibari-cache-config-internal.h" - -static repo conftree = \ -{ \ - .ga = GENALLOC_ZERO, \ - .tree = AVLTREE_INIT(8, 3, 8, &node_dtok, &node_cmp, &conftree.ga), \ - .storage = &g.storage \ -} ; - -void confnode_start (node *node, char const *key, size_t filepos, uint32_t line) -{ - return node_start(&g.storage, node, key, filepos, line) ; -} - -void confnode_add (node *node, char const *s, size_t len) -{ - return node_add(&g.storage, node, s, len) ; -} - -node const *conftree_search (char const *key) -{ - return repo_search(&conftree, key) ; -} - -void conftree_add (node const *node) -{ - return repo_add(&conftree, node) ; -} - -void conftree_update (node const *node) -{ - return repo_update(&conftree, node) ; -} - -static int confnode_write (uint32_t d, unsigned int h, void *data) -{ - node *nod = genalloc_s(node, &conftree.ga) + d ; - (void)h ; - return cdbmake_add((cdbmaker *)data, conftree.storage->s + nod->key, nod->keylen, conftree.storage->s + nod->data, nod->datalen) ; -} - -int conftree_write (cdbmaker *cm) -{ - return avltree_iter(&conftree.tree, &confnode_write, cm) ; -} |