📄 hashtable.h
字号:
/* snap-1.0. Copyright (C) 2000 by Jonathan T. Moore and Michael Hicks. * * hashtable.h : basic hash table library, used for managing the * node-resident service namespace * * $Id: hashtable.h,v 1.2 2003/09/17 11:26:10 tmoerlan Exp $ */#include "list.h"typedef struct { void *key; void *value;} pair_t;typedef struct { int (*cmp)(const void *,const void *); /* for comparing the keys */ int (*hash)(void *); /* for hashing the key */ int max_len; /* max length of bucket list before resize */ list_t **tab; /* the table: an array of lists of pairs */ int tab_sz; /* size of the table */} hash_table_t;/* set to 1 when ht_lookup fails */int ht_errno;/* access functions */hash_table_t *ht_create(int sz, int (*cmp)(const void *,const void *), int (*hash)(void *));void ht_insert(hash_table_t *t, void *key, void *val);void *ht_lookup(hash_table_t *t, void *key);void ht_remove(hash_table_t * t, void *key);/* useful for tables indexed by strings */int hash_string(char *s);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -