File: hash.h

package info (click to toggle)
pktstat 1.8.5-5
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 672 kB
  • ctags: 502
  • sloc: ansic: 4,524; sh: 1,032; makefile: 34
file content (22 lines) | stat: -rw-r--r-- 602 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* David Leonard, 2002. Public domain. */
/* $Id: hash.h 112 2002-01-31 04:25:04Z d $ */

#undef offsetof
#define offsetof(t,f)	((int)(&(((t *)0)->f)))

#define HASHSZ	237

typedef void (*free_t)(const void *);

struct hashelt;
struct hash {
	int		(*cmp)(const void *key1, const void *key2);
	unsigned int	(*hashfn)(const void *key);
	free_t		freekey, freedata;
	struct hashelt *list[HASHSZ];
};

const void *hash_lookup(struct hash *, const void *key);
void hash_store(struct hash *, const void *key, const void *data);
void hash_clear(struct hash *);
unsigned int hash_generic(const void *, size_t);