summaryrefslogtreecommitdiff
path: root/src/cache/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache/conf.c')
-rw-r--r--src/cache/conf.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/cache/conf.c b/src/cache/conf.c
index ea35646..209fdc3 100644
--- a/src/cache/conf.c
+++ b/src/cache/conf.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <skalibs/uint32.h>
+#include <skalibs/uint64.h>
#include <skalibs/cdb.h>
#include "shibari-cache-internal.h"
@@ -23,7 +24,7 @@ int conf_getb (cdb const *c, char const *key, size_t keylen, cdb_data *data)
int conf_get (cdb const *c, char const *key, cdb_data *data)
{
- return conf_get(c, key, strlen(key), data) ;
+ return conf_getb(c, key, strlen(key), data) ;
}
int conf_get_uint32 (cdb const *c, char const *key, uint32_t *value)
@@ -34,3 +35,20 @@ int conf_get_uint32 (cdb const *c, char const *key, uint32_t *value)
uint32_unpack_big(data.s, value) ;
return 1 ;
}
+
+int conf_get_uint64 (cdb const *c, char const *key, uint64_t *value)
+{
+ cdb_data data ;
+ if (!conf_get(conf, key, &data)) return 0 ;
+ if (data.len != 8) return (errno = EPROTO, 0) ;
+ uint64_unpack_big(data.s, value) ;
+ return 1 ;
+}
+
+char const *conf_get_string (cdb const *c, char const *key)
+{
+ cdb_data data ;
+ if (!conf_get(conf, key, &data)) return 0 ;
+ if (!data.len || data.s[data.len - 1]) return (errno = EPROTO, 0) ;
+ return data.s ;
+}