diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:15 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:15 +0200 |
commit | d3c9975943df58e293359b87905d19ff1fd52061 (patch) | |
tree | e416378879f60e8d538b1b25963904f767d30ff4 /Hashtable.h | |
download | debian_htop-d3c9975943df58e293359b87905d19ff1fd52061.tar.gz debian_htop-d3c9975943df58e293359b87905d19ff1fd52061.tar.bz2 debian_htop-d3c9975943df58e293359b87905d19ff1fd52061.zip |
Imported Upstream version 0.5upstream/0.5
Diffstat (limited to 'Hashtable.h')
-rw-r--r-- | Hashtable.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Hashtable.h b/Hashtable.h new file mode 100644 index 0000000..e031cbe --- /dev/null +++ b/Hashtable.h @@ -0,0 +1,55 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Hashtable +#define HEADER_Hashtable +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + + +#include <stdlib.h> +#include <stdbool.h> + +#include "debug.h" + +typedef struct Hashtable_ Hashtable; + +typedef void(*HashtablePairFunction)(int, void*); +typedef int(*HashtableHashAlgorithm)(Hashtable*, int); + +typedef struct HashtableItem { + int key; + void* value; + struct HashtableItem* next; +} HashtableItem; + +struct Hashtable_ { + int size; + HashtableItem** buckets; + int items; + HashtableHashAlgorithm hashAlgorithm; + bool owner; +}; + +HashtableItem* HashtableItem_new(int key, void* value); + +Hashtable* Hashtable_new(int size, bool owner); + +int Hashtable_hashAlgorithm(Hashtable* this, int key); + +void Hashtable_delete(Hashtable* this); + +inline int Hashtable_size(Hashtable* this); + +void Hashtable_put(Hashtable* this, int key, void* value); + +void* Hashtable_remove(Hashtable* this, int key); + +inline void* Hashtable_get(Hashtable* this, int key); + +void Hashtable_foreach(Hashtable* this, HashtablePairFunction f); + +#endif |