nostrdb

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

ptr_set.h (509B)


      1 #ifndef HT_PTR_SET_H
      2 #define HT_PTR_SET_H
      3 
      4 #include "hash_table.h"
      5 
      6 DECLARE_HASH_TABLE(ptr_set, void *)
      7 
      8 /* Return value helpers - these are specific to the implementation. */
      9 #define PTR_SET_IS_MISSING(x) ((void *)x == (void *)0)
     10 #define PTR_SET_IS_ERROR(x) ((void *)x == (void *)2)
     11 #define PTR_SET_IS_VALID(x) ((void *)x > (void *)2)
     12 
     13 /* Extensions to std. interface. */
     14 static inline int ptr_set_exists(ptr_set_t *S, void *p)
     15 {
     16     return ptr_set_find_item(S, p) != (void *)0;
     17 }
     18 
     19 #endif /* HT_PTR_SET_H */