nostrdb/nostr_bech32: only parse up to raw bech32 buffers

We will be storing raw nostr bech32 buffers directly into nostrdb, so
adapt our bech32 code to reflect this.

When doing our content parsing pass, we will only look for strings and we
won't allocate any intermediate buffers. Only when we write this string
block to nostrdb will we actually allocate in our nostrdb output buffer
(no mallocs!)

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2023-12-27 12:35:54 -08:00
committed by Daniel D’Aquino
parent 30ba0d72cc
commit aa5809d792
4 changed files with 166 additions and 93 deletions

12
nostrdb/src/str_block.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef NDB_STR_BLOCK_H
#define NDB_STR_BLOCK_H
#include <inttypes.h>
struct str_block {
const char *str;
uint32_t len;
};
#endif