X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/frsh-forb.git/blobdiff_plain/c186fc339a8dc6b85bd6841ad67a4df214b9c9bf..e945cea139ee26d1776b8b6fdb577e27047a2ec7:/src/fwp/fwp/tests/hashtest/hashtable.h diff --git a/src/fwp/fwp/tests/hashtest/hashtable.h b/src/fwp/fwp/tests/hashtest/hashtable.h deleted file mode 100644 index 2ff971fd..00000000 --- a/src/fwp/fwp/tests/hashtest/hashtable.h +++ /dev/null @@ -1,58 +0,0 @@ -#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 - -/* 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 */