kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

uthash_probe.c (392B)


      1 #include <stdlib.h>
      2 
      3 #include "uthash.h"
      4 
      5 typedef struct Entry {
      6   int key;
      7   int value;
      8   UT_hash_handle hh;
      9 } Entry;
     10 
     11 int main(void) {
     12   Entry* table = NULL;
     13   Entry* found = NULL;
     14   Entry first = {7, 42, {0}};
     15 
     16   HASH_ADD_INT(table, key, &first);
     17   HASH_FIND_INT(table, &first.key, found);
     18   if (!found || found->value != 42) return 1;
     19   HASH_DEL(table, &first);
     20   return table != NULL;
     21 }