hash.h
来自「linux环境下用纯c写的RTP协议的通用开发库」· C头文件 代码 · 共 64 行
H
64 行
/* * $Id: hash.h,v 1.3 2000/03/01 03:21:02 evangemh Exp $ */#ifndef HASH_H#define HASH_H#include <pthread.h>/* structure for hashtable entry */struct htent { unsigned int hte_key; /* key; may be pointer */ void *hte_object; /* pointer to object */ struct htent *hte_chain; /* next htent in bucket */};/* structure for hashtable */struct ht { struct htent **ht_entries; /* array of buckets */ int (* ht_hashfcn)(unsigned int, int);/* ptr to hash function */ int (* ht_cmpfcn)(unsigned int, unsigned int); /* ptr to comparison function; should return 0 on equal. */ void (* ht_destroykeyfcn)(unsigned int); /* ptr to function to destroy or free key */ void (* ht_destroyobjectfcn)(void *); /* ptr to function to destroy or free object */ int ht_size; /* number of buckets */ int ht_count; /* number of items in table */ pthread_mutex_t ht_writepend; /* mutexes and counters to */ pthread_mutex_t ht_readblk; /* implement basic readers */ pthread_mutex_t ht_writeblk; /* writers locking with */ pthread_mutex_t ht_rdcntmutex; /* priority given to writers. */ pthread_mutex_t ht_wrcntmutex; int ht_readcnt; int ht_writecnt;};/* API calls */char *htget(struct ht *, unsigned int);struct ht *htnew(int, int(*)(unsigned int, int), int(*)(unsigned int, unsigned int), void(*)(unsigned int), void(*)(void *));int htadd(struct ht *, unsigned int, void *);int htdel(struct ht *, unsigned int);int htdestroy(struct ht *);int htcount(struct ht *);struct htent **htenum(struct ht *);/* Internal calls */struct htent *htgetent(struct ht *, unsigned int);void htreaderbegin(struct ht *);void htreaderend(struct ht *);void htwriterbegin(struct ht *);void htwriterend(struct ht *);/* Hash and comparison functions */int hashstring(unsigned int, int);int hashunsignedint(unsigned int, int);int unsignedinteq(unsigned int, unsigned int);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?