view src/ploki/hash.h @ 7638:25b838ae35f6

<boily> le/rn wat/\xe1\x8a\xa2\xe1\x89\xb5\xe1\x8b\xae\xe1\x8c\xb5\xe1\x8b\xab \xe1\x8b\x8d\xe1\x88\xb5\xe1\x8c\xa5 \xe1\x8b\xa8\xe1\x88\x9a\xe1\x88\xb0\xe1\x88\xab \xe1\x8b\xa8\xe1\x88\x9d\xe1\x8c\x8d\xe1\x89\xa5 \xe1\x8a\xa0\xe1\x8b\xad\xe1\x8a\x90\xe1\x89\xb5 \xe1\x88\xb2\xe1\x88\x86\xe1\x8a\x95\xe1\x8d\xa3 \xe1\x8b\xa8\xe1\x88\x9a\xe1\x88\xb0\xe1\x88\xab\xe1\x8b\x8d\xe1\x88\x9d \xe1\x8a\xa8\xe1\x8c\xa4\xe1\x8d\x8d \xe1\x8a\x90\xe1\x8b\x8d\xe1\x8d\xa2
author HackBot
date Sun, 01 May 2016 22:44:03 +0000
parents ac0403686959
children
line wrap: on
line source

#ifndef HASH_H_
#define HASH_H_

#include <stddef.h>

typedef struct {
	size_t entries, size, newsize;
	size_t brk;
	size_t seed;
	size_t iter;
	struct h_node *iterptr;
	struct h_node **table;
	size_t (*hash)(const void *, size_t);
	int (*cmp)(const void *, const void *);
	void (*delk)(void *);
	void (*delv)(void *);
} Hash;

enum {
	H_OK,
	H_EXIST,
	H_NOENT
};

void h_init(
		Hash *,
		size_t (*)(const void *, size_t),
		int (*)(const void *, const void *),
		void (*)(void *),
		void (*)(void *)
		);
void h_end(Hash *);
int h_get(Hash *, const void *, void **);
int h_del(Hash *, const void *);
#if 0
void h_push(Hash *, void *, void *);
#endif
int h_put(Hash *, void *, void *, int);
void h_reset(Hash *);
int h_nextkv(Hash *, void **, void **);

#if 0
size_t h_entries(const Hash *);
#define h_entries(h) ((h)->entries + 0)
#endif

#endif /* HASH_H_ */