diff options
Diffstat (limited to 'src/hashmap.h')
-rw-r--r-- | src/hashmap.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/hashmap.h b/src/hashmap.h index 69fe21a..aa376d4 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -1,4 +1,4 @@ -/* $Id: hashmap.h,v 1.3 2005-07-12 17:39:44 rjkaes Exp $ +/* $Id: hashmap.h,v 1.4 2005-08-15 03:54:31 rjkaes Exp $ * * A hashmap implementation. The keys are case-insensitive NULL terminated * strings, and the data is arbitrary lumps of data. Copies of both the @@ -38,15 +38,15 @@ extern "C" { * hash map. Sure, it's a pointer, but the struct is hidden in the C file. * So, just use the hashmap_t like it's a cookie. :) */ -typedef struct hashmap_s* hashmap_t; -typedef int hashmap_iter; + typedef struct hashmap_s *hashmap_t; + typedef int hashmap_iter; /* * hashmap_create() takes one argument, which is the number of buckets to * use internally. hashmap_delete() is self explanatory. */ -extern hashmap_t hashmap_create(unsigned int nbuckets); -extern int hashmap_delete(hashmap_t map); + extern hashmap_t hashmap_create(unsigned int nbuckets); + extern int hashmap_delete(hashmap_t map); /* * When the you insert a key/data pair into the hashmap it will the key @@ -57,15 +57,15 @@ extern int hashmap_delete(hashmap_t map); * Returns: negative on error * 0 upon successful insert */ -extern int hashmap_insert(hashmap_t map, const char *key, - const void *data, size_t len); + extern int hashmap_insert(hashmap_t map, const char *key, + const void *data, size_t len); /* * Get an iterator to the first entry. * * Returns: an negative value upon error. */ -extern hashmap_iter hashmap_first(hashmap_t map); + extern hashmap_iter hashmap_first(hashmap_t map); /* * Checks to see if the iterator is pointing at the "end" of the entries. @@ -73,7 +73,7 @@ extern hashmap_iter hashmap_first(hashmap_t map); * Returns: 1 if it is the end * 0 otherwise */ -extern int hashmap_is_end(hashmap_t map, hashmap_iter iter); + extern int hashmap_is_end(hashmap_t map, hashmap_iter iter); /* * Return a "pointer" to the first instance of the particular key. It can @@ -83,7 +83,7 @@ extern int hashmap_is_end(hashmap_t map, hashmap_iter iter); * an "iterator" pointing at the first key * an "end-iterator" if the key wasn't found */ -extern hashmap_iter hashmap_find(hashmap_t map, const char* key); + extern hashmap_iter hashmap_find(hashmap_t map, const char *key); /* * Retrieve the key/data associated with a particular iterator. @@ -93,8 +93,8 @@ extern hashmap_iter hashmap_find(hashmap_t map, const char* key); * Returns: the length of the data block upon success * negative upon error */ -extern ssize_t hashmap_return_entry(hashmap_t map, hashmap_iter iter, - char** key, void** data); + extern ssize_t hashmap_return_entry(hashmap_t map, hashmap_iter iter, + char **key, void **data); /* * Get the first entry (assuming there is more than one) for a particular @@ -104,7 +104,8 @@ extern ssize_t hashmap_return_entry(hashmap_t map, hashmap_iter iter, * zero if no entry is found * length of data for the entry */ -extern ssize_t hashmap_entry_by_key(hashmap_t map, const char* key, void** data); + extern ssize_t hashmap_entry_by_key(hashmap_t map, const char *key, + void **data); /* * Searches for _any_ occurrances of "key" within the hashmap and returns the @@ -114,7 +115,7 @@ extern ssize_t hashmap_entry_by_key(hashmap_t map, const char* key, void** data) * zero if no key is found * count found (positive value) */ -extern ssize_t hashmap_search(hashmap_t map, const char *key); + extern ssize_t hashmap_search(hashmap_t map, const char *key); /* * Go through the hashmap and remove the particular key. @@ -124,10 +125,9 @@ extern ssize_t hashmap_search(hashmap_t map, const char *key); * 0 if the key was not found * positive count of entries deleted */ -extern ssize_t hashmap_remove(hashmap_t map, const char *key); + extern ssize_t hashmap_remove(hashmap_t map, const char *key); #if defined(__cplusplus) } -#endif /* C++ */ - -#endif /* _HASHMAP_H */ +#endif /* C++ */ +#endif /* _HASHMAP_H */ |