Commit 6b8cd21b authored by Lenitra's avatar Lenitra
Browse files

1010111

parent 47c35c61
Loading
Loading
Loading
Loading
+10
Changes for src/hash_tbl.c: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,6 +17,16 @@ typedef struct hash_tbl* hash_tbl;
hash_tbl htbl_empty(size_t (*h)(void*),
                    int (*eq)(void*, void*),
                    void (*free)(void*)){
  hash_tbl htbl = malloc(sizeof(*htbl));
  htbl->h = h;
  htbl->eq = eq;
  htbl->free = free;
  htbl->size = 0;
  htbl->capacity = ARRAY_CAPACITY;
  htbl->array = malloc(sizeof(*htbl->array) * htbl->capacity);
  for (size_t i = 0; i < htbl->capacity; i++)
    htbl->array[i] = list_empty();
  return htbl;
}

int htbl_add(hash_tbl htbl, void* x){