Skip to content
Snippets Groups Projects
Select Git revision
  • main
1 result

hash_tbl.h

Blame
  • user avatar
    Matthieu Dien authored
    1657c766
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    hash_tbl.h 513 B
    #ifndef __HASH_TBL__
    #define __HASH_TBL__
    
    #include "linked_list.h"
    
    struct hash_tbl {
      size_t (*h)(void*);
      int (*eq)(void*, void*);
      void (*free)(void*);
      unsigned long int size;
      unsigned long int capacity; // array length
      list_t* array;
    };
    
    typedef struct hash_tbl* hash_tbl;
    
    hash_tbl htbl_empty(size_t (*h)(void*),
                        int (*eq)(void*, void*),
                        void (*free)(void*));
    int htbl_add(hash_tbl, void*);
    int htbl_in(hash_tbl, void*);
    void htbl_free(hash_tbl);
    
    #endif