nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit 4de1ee874948d1b1763afba62a644123100c4a9a
parent 09401e5f35ed940019865b7ec40da3e18d2e3480
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 27 Dec 2023 12:42:40 -0800

search: switch to cursor_align function

Diffstat:
Msrc/nostrdb.c | 11++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -219,7 +219,6 @@ static int ndb_make_text_search_key(unsigned char *buf, int bufsize, int *keysize) { struct cursor cur; - int size, pad; make_cursor(buf, buf + bufsize, &cur); // TODO: need update this to uint64_t @@ -245,15 +244,9 @@ static int ndb_make_text_search_key(unsigned char *buf, int bufsize, if (!cursor_push_varint(&cur, word_index)) return 0; - size = cur.p - cur.start; - // pad to 8-byte alignment - pad = ((size + 7) & ~7) - size; - if (pad > 0) { - if (!cursor_memset(&cur, 0, pad)) { - return 0; - } - } + if (!cursor_align(&cur, 8)) + return 0; *keysize = cur.p - cur.start; assert((*keysize % 8) == 0);