types.h
author Dan Winship <danw@gnome.org>
Thu Feb 07 09:58:48 2008 -0500 (2008-02-07)
changeset 115 26edeea5c95a
child 116 4ec6e2a55c34
permissions -rw-r--r--
split array and hashtable code out into a new file
danw@115
     1
#ifndef _RAZOR_TYPES_H_
danw@115
     2
#define _RAZOR_TYPES_H_
danw@115
     3
danw@115
     4
#include <stdint.h>
danw@115
     5
danw@115
     6
struct array {
danw@115
     7
	void *data;
danw@115
     8
	int size, alloc;
danw@115
     9
};
danw@115
    10
danw@115
    11
void array_init(struct array *array);
danw@115
    12
void array_release(struct array *array);
danw@115
    13
void *array_add(struct array *array, int size);
danw@115
    14
danw@115
    15
danw@115
    16
struct hashtable {
danw@115
    17
	struct array buckets;
danw@115
    18
	struct array *pool;
danw@115
    19
};
danw@115
    20
danw@115
    21
void hashtable_init(struct hashtable *table, struct array *pool);
danw@115
    22
void hashtable_release(struct hashtable *table);
danw@115
    23
uint32_t hashtable_insert(struct hashtable *table, const char *key);
danw@115
    24
uint32_t hashtable_lookup(struct hashtable *table, const char *key);
danw@115
    25
uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
danw@115
    26
danw@115
    27
#endif /* _RAZOR_TYPES_H_ */