about summary refs log tree commit diff
path: root/src/cache/conf.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2024-07-25 00:20:30 +0000
committerLaurent Bercot <ska@appnovation.com>2024-07-25 00:20:30 +0000
commitfc85d676b5ca3de92264dfcb41c98d7c9b0d1398 (patch)
treec9e77e23b9b2b35760f18ce8a7c36ab921b9905d /src/cache/conf.c
parent8c9b0194063411882d3bbcec80d5e5c861d37544 (diff)
downloadshibari-fc85d676b5ca3de92264dfcb41c98d7c9b0d1398.tar.gz
shibari-fc85d676b5ca3de92264dfcb41c98d7c9b0d1398.tar.xz
shibari-fc85d676b5ca3de92264dfcb41c98d7c9b0d1398.zip
More shibari-cache stuff
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/cache/conf.c')
-rw-r--r--src/cache/conf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cache/conf.c b/src/cache/conf.c
index 209fdc3..c2f3d6b 100644
--- a/src/cache/conf.c
+++ b/src/cache/conf.c
@@ -27,6 +27,15 @@ int conf_get (cdb const *c, char const *key, cdb_data *data)
   return conf_getb(c, key, strlen(key), data) ;
 }
 
+int conf_get_uint16 (cdb const *c, char const *key, uint16_t *value)
+{
+  cdb_data data ;
+  if (!conf_get(conf, key, &data)) return 0 ;
+  if (data.len != 2) return (errno = EPROTO, 0) ;
+  uint16_unpack_big(data.s, value) ;
+  return 1 ;
+}
+
 int conf_get_uint32 (cdb const *c, char const *key, uint32_t *value)
 {
   cdb_data data ;