nostrdb/blocks: expose block iterator internals

so we don't need heap allocation. we will be calling this a lot in tight
render loops, we don't want to be allocating on each frame.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-08-11 16:39:43 -07:00
committed by Daniel D’Aquino
parent d063362bd7
commit c677233dcb
5 changed files with 50 additions and 56 deletions
-20
View File
@@ -29,26 +29,6 @@ struct ndb_blocks {
#pragma pack(pop)
struct ndb_mention_bech32_block {
struct ndb_str_block str;
struct nostr_bech32 bech32;
};
struct ndb_invoice_block {
struct ndb_str_block invstr;
struct ndb_invoice invoice;
};
struct ndb_block {
enum ndb_block_type type;
union {
struct ndb_str_block str;
struct ndb_invoice_block invoice;
struct ndb_mention_bech32_block mention_bech32;
uint32_t mention_index;
} block;
};
int push_str_block(struct cursor *buf, const char *content, struct ndb_str_block *block);
int pull_str_block(struct cursor *buf, const char *content, struct ndb_str_block *block);