+++ /dev/null
-#ifndef _HASHTABLE_H
-#define _HASHTABLE_H
-
-/* Zbyva nadefinovat iteraci pres zretazeny seznam
- *
- *mozno vyheldavat zaznamu dle label
- *
- */
-
-#include "list.h"
-//#include "ul_list.h"
-#include <stdlib.h>
-
-/* Hash table with linked list per each entry*/
-struct hash_table {
- struct list_head *entries;
- unsigned int size;
-};
-
-static inline int htable_init(struct hash_table *htable, int size)
-{
- int i;
-
- void *entries = malloc(sizeof(struct list_head) * size);
- if (!entries)
- return -1;
-
- htable->entries = (struct list_head*) entries;
- htable->size = size;
- for ( i = 0; i < size; i++)
- INIT_LIST_HEAD(&htable->entries[i]);
-
- return 0;
-}
-
-static inline void htable_free(struct hash_table *htable)
-{
- free(htable->entries);
- htable->entries = NULL;
- htable->size = 0;
-}
-
-
-static inline void htable_add(struct hash_table *htable, unsigned int hash,
- struct list_head *new)
-{
- __list_add(new, htable->entries[hash].prev, &htable->entries[hash]);
-}
-
-
-static inline void htable_del(struct hash_table *htable, unsigned int hash,
- struct list_head *new)
-{
- __list_add(new, htable->entries[hash].prev, &htable->entries[hash]);
-}
-
-
-#endif /* _HASHTABLE_H */