freebsd-skq/usr.bin/grep/regex/hashtable.h
gabor 1cb16d9887 Update BSD grep to the latest development version. It has some code
backported that was written for the TRE integration project in Google
Summer of Code 2011.  This is a temporary solution until the whole
regex library is not replaced so that BSD grep development can continue
and the backported code gets some review and testing.  This change only
improves scalability slightly, there is no big performance boost yet
but several minor bugs have been found and fixed.

Approved by:	delphij (mentor)
Sposored by:	Google Summer of Code 2011
MFC after:	1 week
2011-10-05 09:56:43 +00:00

36 lines
737 B
C

/* $FreeBSD$ */
#ifndef HASHTABLE_H
#define HASHTABLE_H 1
#include <sys/types.h>
#define HASH_OK 0
#define HASH_UPDATED 1
#define HASH_FAIL 2
#define HASH_FULL 3
#define HASH_NOTFOUND 4
#define HASHSTEP(x,c) (((x << 5) + x) + (c))
typedef struct {
void *key;
void *value;
} hashtable_entry;
typedef struct {
size_t key_size;
size_t table_size;
size_t usage;
size_t value_size;
hashtable_entry **entries;
} hashtable;
void hashtable_free(hashtable *);
int hashtable_get(hashtable *, const void *, void *);
hashtable *hashtable_init(size_t, size_t, size_t);
int hashtable_put(hashtable *, const void *, const void *);
int hashtable_remove(hashtable *, const void *);
#endif /* HASHTABLE.H */