damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 9ff1f69a828cee0d70fa1b46f3d5821d2da405ff
parent 623b8603c2793703a0be63a733a21238af0b3cd3
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 27 Dec 2023 12:42:40 -0800

nostrdb/search: switch to cursor_align function

Signed-off-by: William Casarin <jb55@jb55.com>

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

diff --git a/nostrdb/src/nostrdb.c b/nostrdb/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);