rcx

miscellaneous C library
git clone git://git.rr3.xyz/rcx
Log | Files | Refs | README | LICENSE

decls.h (797B)


      1 /* TODO: Add methods for shrinking the table and reserving space? */
      2 
      3 TABLE_STATIC UNUSED int TABLE_METHOD(init)(RTable *t, usize hint TABLE_SPEC_PARAM);
      4 TABLE_STATIC UNUSED int TABLE_METHOD(acc)(RTable *t, void **v, void *k, u64 h TABLE_SPEC_PARAM);
      5 TABLE_STATIC UNUSED int TABLE_METHOD(ins)(RTable *t, void **v, void *k, u64 h TABLE_SPEC_PARAM);
      6 TABLE_STATIC UNUSED int TABLE_METHOD(del)(RTable *t, void **v, void *k, u64 h TABLE_SPEC_PARAM);
      7 TABLE_STATIC UNUSED void TABLE_METHOD(clr)(RTable *t TABLE_SPEC_PARAM);
      8 
      9 static inline UNUSED void
     10 TABLE_METHOD(free)(RTable *t TABLE_SPEC_PARAM) {
     11 	int e = errno;
     12 	TABLE_FREE(t->mem);
     13 	t->data = 0; /* Ensure hard error on use after free. */
     14 	errno = e;
     15 }
     16 
     17 static inline UNUSED usize
     18 TABLE_METHOD(len)(RTable *t TABLE_SPEC_PARAM) {
     19 	return t->count;
     20 }