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
     1 #ifndef _RAZOR_TYPES_H_
     2 #define _RAZOR_TYPES_H_
     3 
     4 #include <stdint.h>
     5 
     6 struct array {
     7 	void *data;
     8 	int size, alloc;
     9 };
    10 
    11 void array_init(struct array *array);
    12 void array_release(struct array *array);
    13 void *array_add(struct array *array, int size);
    14 
    15 
    16 struct hashtable {
    17 	struct array buckets;
    18 	struct array *pool;
    19 };
    20 
    21 void hashtable_init(struct hashtable *table, struct array *pool);
    22 void hashtable_release(struct hashtable *table);
    23 uint32_t hashtable_insert(struct hashtable *table, const char *key);
    24 uint32_t hashtable_lookup(struct hashtable *table, const char *key);
    25 uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
    26 
    27 #endif /* _RAZOR_TYPES_H_ */