📄 hash.h
字号:
/* * Write :Gan Jian Hui * Date : 2006/07/18 * Description : hash table manager * * */#ifndef _LINUX_GHASH_H_#define _LINUX_GHASH_H_#include <string.h>/*#include <stdlib.h> */#ifndef __USE_ISOC99#define inline#endif#define create_hashtable(hsize) hash_create(lh_strhash, equal_str, hsize) /* * hash function*/unsigned int lh_strhash(void *src) ;int equal_str(void *k1, void *k2) ;struct hashentry ;struct _hashtable ;typedef struct _hashtable hashtable ; /** Description :Create hash table ** sizeof(struct _hashtable) = 16* sizeof(void *)= 4 * tab->hashlist size= 4*size **/hashtable *hash_create(unsigned int (*keyfunc)(void *), int (*comparefunc)(void *,void *), int size) ;/* * *Desc : free hash table * */void hash_free(hashtable *tab) ;/* *Desc : Insert Data to hash table * * */void hash_insert(void *key, void *data, hashtable *tab) ;/* * *Desc :Remove Item from hash table * * */void hash_remove(void *key, hashtable *tab) ;void *hash_value(void *key, hashtable *tab) ;void hash_for_each_do (hashtable *tab, int (cb)(void *, void *, void*), void *userdata) ;/*int hash_toarray2 (hashtable *tab, void **key, void **data) ;int hash_toarray(hashtable *tab, struct dataentry **dest) ;*/int hash_count(hashtable *tab) ;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -