nostrdb

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

name_table.c (528B)


      1  /* Note: only one hash table can be implemented a single file. */
      2 #include "../symbols.h"
      3 #include "hash/hash_table_def.h"
      4 DEFINE_HASH_TABLE(fb_name_table)
      5 
      6 #include "hash/hash_table_impl.h"
      7 
      8 static inline int ht_match(const void *key, size_t len, fb_name_t *name)
      9 {
     10     return len == (size_t)name->name.s.len && memcmp(key, name->name.s.s, len) == 0;
     11 }
     12 
     13 static inline const void *ht_key(fb_name_t *name)
     14 {
     15     return name->name.s.s;
     16 }
     17 
     18 static inline size_t ht_key_len(fb_name_t *name)
     19 {
     20     return (size_t)name->name.s.len;
     21 }