nostrdb

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

commit 837358654cc4d4d0f0b4b2604a1ed53794b1faeb
parent 47b016f7ff7e655b5a2acabf61a3fdb3605cad52
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 24 Jul 2023 14:39:41 -0700

ndb_builder_new -> ndb_builder_init

this is more standard

Diffstat:
Mnostrdb.c | 6+++---
Mnostrdb.h | 2+-
Mtest.c | 4++--
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/nostrdb.c b/nostrdb.c @@ -20,8 +20,8 @@ static inline int cursor_push_tag(struct cursor *cur, struct ndb_tag *tag) return cursor_push_u16(cur, tag->count); } -int ndb_builder_new(struct ndb_builder *builder, unsigned char *buf, - int bufsize) +int ndb_builder_init(struct ndb_builder *builder, unsigned char *buf, + int bufsize) { struct ndb_note *note; struct cursor mem; @@ -82,7 +82,7 @@ static inline int ndb_json_parser_init(struct ndb_json_parser *p, // the more important stuff gets a larger chunk and then it spirals // downward into smaller chunks. Thanks for coming to my TED talk. - if (!ndb_builder_new(&p->builder, buf, half)) + if (!ndb_builder_init(&p->builder, buf, half)) return 0; jsmn_init(&p->json_parser); diff --git a/nostrdb.h b/nostrdb.h @@ -79,7 +79,7 @@ struct ndb_iterator { // HI BUILDER int ndb_note_from_json(const char *json, int len, struct ndb_note **, unsigned char *buf, int buflen); -int ndb_builder_new(struct ndb_builder *builder, unsigned char *buf, int bufsize); +int ndb_builder_init(struct ndb_builder *builder, unsigned char *buf, int bufsize); int ndb_builder_finalize(struct ndb_builder *builder, struct ndb_note **note); int ndb_builder_set_content(struct ndb_builder *builder, const char *content, int len); void ndb_builder_set_signature(struct ndb_builder *builder, unsigned char *signature); diff --git a/test.c b/test.c @@ -25,7 +25,7 @@ static void test_basic_event() { const char *hex_pk = "5d9b81b2d4d5609c5565286fc3b511dc6b9a1b3d7d1174310c624d61d1f82bb9"; - ok = ndb_builder_new(b, buf, sizeof(buf)); + ok = ndb_builder_init(b, buf, sizeof(buf)); assert(ok); note = builder.note; @@ -87,7 +87,7 @@ static void test_empty_tags() { int ok; unsigned char buf[1024]; - ok = ndb_builder_new(b, buf, sizeof(buf)); + ok = ndb_builder_init(b, buf, sizeof(buf)); assert(ok); ok = ndb_builder_finalize(b, &note);