ndb: update lib

This commit is contained in:
William Casarin
2023-07-22 16:57:16 -07:00
parent c74993366b
commit 4da23390f8
2 changed files with 237 additions and 31 deletions

View File

@@ -40,6 +40,7 @@ struct ndb_note {
uint32_t created_at;
uint32_t kind;
uint32_t content_length;
union packed_str content;
uint32_t strings;
uint32_t json;
@@ -84,6 +85,7 @@ static inline int ndb_str_is_packed(union packed_str str)
return (str.offset >> 31) & 0x1;
}
static inline const char * ndb_note_str(struct ndb_note *note,
union packed_str *str)
{
@@ -99,7 +101,7 @@ static inline const char * ndb_tag_str(struct ndb_note *note,
return ndb_note_str(note, &tag->strs[ind]);
}
static inline int ndb_tag_matches_char(struct ndb_note *note,
static int ndb_tag_matches_char(struct ndb_note *note,
struct ndb_tag *tag, int ind, char c)
{
const char *str = ndb_tag_str(note, tag, ind);
@@ -136,11 +138,21 @@ static inline uint32_t ndb_note_created_at(struct ndb_note *note)
return note->created_at;
}
static inline uint32_t ndb_note_kind(struct ndb_note *note)
{
return note->kind;
}
static inline const char * ndb_note_content(struct ndb_note *note)
{
return ndb_note_str(note, &note->content);
}
static inline uint32_t ndb_note_content_length(struct ndb_note *note)
{
return note->content_length;
}
static inline struct ndb_note * ndb_note_from_bytes(unsigned char *bytes)
{
struct ndb_note *note = (struct ndb_note *)bytes;