nostrdb

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

commit 7b9fa9d15ac5b2ae5ab1e60e9563824828d4fd39
parent 122d96589a50bc142f9dc085c707ee8ab779abd3
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 22 Jul 2023 10:44:22 -0700

use strncmp instead of strcmp

saves us the strlen I believe

Diffstat:
Mnostrdb.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nostrdb.c b/nostrdb.c @@ -143,7 +143,7 @@ int ndb_builder_make_string(struct ndb_builder *builder, const char *str, uint32_t index = ((uint32_t*)builder->str_indices.start)[i]; const char *some_str = (const char*)builder->strings.start + index; - if (!strcmp(some_str, str)) { + if (!strncmp(some_str, str, len)) { // found an existing matching str, use that index *pstr = ndb_offset_str(index); return 1;