hash.h

来自「举世闻名的joe记事本源程序」· C头文件 代码 · 共 41 行

H
41
字号
/* *	Simple hash table *	Copyright *		(C) 1992 Joseph H. Allen * *	This file is part of JOE (Joe's Own Editor) */#ifndef _JOE_HASH_H#define _JOE_HASH_H 1struct entry {	HENTRY *next;	unsigned char *name;	unsigned hash_val;	void *val;};struct hash {	unsigned len;	HENTRY **tab;	unsigned nentries;};/* Compute hash code for a string */unsigned long hash PARAMS((unsigned char *s));/* Create a hash table of specified size, which must be a power of 2 */HASH *htmk PARAMS((int len));/* Delete a hash table.  HENTRIES get freed, but name/vals don't. */void htrm PARAMS((HASH *ht));/* Add an entry to a hash table.  Note: 'name' is _not_ strdup()ed */void *htadd PARAMS((HASH *ht, unsigned char *name, void *val));/* Look up an entry in a hash table, returns NULL if not found */void *htfind PARAMS((HASH *ht, unsigned char *name));#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?