?? hashlist.h
字號(hào):
/*
* Copyright (c) 2000-2008
* Author: Weiming Zhou
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*/
#ifndef __HASHLIST_H__
#define __HASHLIST_H__
#ifdef __cplusplus
extern "C" {
#endif
#define MINIUM_BUCKET_COUNT 32
typedef struct HASHLISTNODE_st {
struct HASHLISTNODE_st *pListNext; /* 鏈表的后向節(jié)點(diǎn)指針 */
struct HASHLISTNODE_st *pListPrev; /* 鏈表的前向節(jié)點(diǎn)指針 */
struct HASHLISTNODE_st *pBucketNext; /* 哈希表的鏈接指針 */
void *pData; /* 數(shù)據(jù)指針 */
} HASHLISTNODE;
typedef struct HASHLIST_st {
HASHLISTNODE **ppBuckets; /* 哈希表的索引表 */
UINT uBucketCount; /* 索引表的大小 */
HASHLISTNODE *pHead; /* 鏈表的頭指針 */
HASHLISTNODE *pTail; /* 鏈表的尾指針 */
UINT uNodeCount; /* 哈希鏈表中的節(jié)點(diǎn)個(gè)數(shù) */
} HASHLIST;
HASHLIST *HashList_Create(UINT uBucketCount);
void HashList_Destroy(HASHLIST *pHashList,
DESTROYFUNC DestroyFunc);
INT HashList_InsertHead(HASHLIST *pHashList, void *pData, HASHFUNC HashFunc);
INT HashList_Delete(HASHLIST *pHashList,
void *pData,
HASHFUNC HashFunc,
COMPAREFUNC HashCompareFunc,
DESTROYFUNC DestroyFunc);
HASHLISTNODE *HashList_FindNode(HASHLIST *pHashList,
void *pData,
HASHFUNC HashFunc,
COMPAREFUNC CompareFunc);
void *HashList_FindData(HASHLIST *pHashList,
void *pData,
HASHFUNC HashFunc,
COMPAREFUNC CompareFunc);
INT HashList_InsertSort(HASHLIST *pHashList, COMPAREFUNC CompareFunc);
UINT HashStr( void *str, UINT str_len, UINT numBuckets );
UINT HashStrCompare( void *str1, UINT str1_len, void *str2, UINT str2_len );
void HashFree(void *pData, UINT uDataLen);
#ifdef __cplusplus
}
#endif
#endif /* __HASHLIST_H__ */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -