hash.h

来自「一個C語言hash表的實現 hash.c hash.h Makefile」· C头文件 代码 · 共 100 行

H
100
字号
/* * 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 + =
减小字号Ctrl + -
显示快捷键?