diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-12-10 11:48:01 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2023-12-10 11:48:01 +0000 |
| commit | b8d0f83e6cea9640a7ee4402c163ad812237355d (patch) | |
| tree | 57a64ac8aa0e98c40db8c36e96e7379490e44dbf /src/server/shibari_tdb_read_entry.c | |
| download | shibari-b8d0f83e6cea9640a7ee4402c163ad812237355d.tar.gz | |
Initial commit
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/server/shibari_tdb_read_entry.c')
| -rw-r--r-- | src/server/shibari_tdb_read_entry.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/shibari_tdb_read_entry.c b/src/server/shibari_tdb_read_entry.c new file mode 100644 index 0000000..b2d877c --- /dev/null +++ b/src/server/shibari_tdb_read_entry.c @@ -0,0 +1,22 @@ +/* ISC license. */ + +#include <skalibs/cdb.h> + +#include <shibari/tdb.h> + +int shibari_tdb_read_entry (cdb const *tdb, cdb_find_state *state, shibari_tdb_entry *out, char const *s, uint16_t len, uint16_t qtype, unsigned int wild, char const *loc, tain const *stamp, uint32_t *flags) +{ + cdb_data data ; + int r = 0 ; + while (!r) + { + r = cdb_findnext(tdb, &data, s, len, state) ; + if (r <= 0) return r ; + if (flags) *flags |= 1 ; + r = shibari_tdb_entry_parse(out, data.s, data.len, qtype, wild, loc, stamp) ; + if (r == -1) return -1 ; + } + out->key.s = s ; + out->key.len = len ; + return 1 ; +} |
