From 17c382d1c9d7236c101418060758d2296cc5e17e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 5 Aug 2023 11:51:25 +0000 Subject: Initial commit Signed-off-by: Laurent Bercot --- src/libtipidee/tipidee_conf_get_uint32.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/libtipidee/tipidee_conf_get_uint32.c (limited to 'src/libtipidee/tipidee_conf_get_uint32.c') diff --git a/src/libtipidee/tipidee_conf_get_uint32.c b/src/libtipidee/tipidee_conf_get_uint32.c new file mode 100644 index 0000000..ad8b21b --- /dev/null +++ b/src/libtipidee/tipidee_conf_get_uint32.c @@ -0,0 +1,19 @@ +/* ISC license. */ + +#include + +#include +#include + +#include + +#include + +int tipidee_conf_get_uint32 (tipidee_conf const *conf, char const *key, uint32_t *value) +{ + cdb_data data ; + if (!tipidee_conf_get(conf, key, &data)) return 0 ; + if (data.len != 4) return (errno = EPROTO, 0) ; + uint32_unpack_big(data.s, value) ; + return 1 ; +} -- cgit v1.3.1