diff options
Diffstat (limited to 'src/hashmap.h')
-rw-r--r-- | src/hashmap.h | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/hashmap.h b/src/hashmap.h index 0bde82c..946b619 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -23,7 +23,8 @@ /* Allow the use in C++ code. */ #if defined(__cplusplus) -extern "C" { +extern "C" +{ #endif /* @@ -31,15 +32,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 @@ -50,15 +51,15 @@ extern "C" { * 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. @@ -66,7 +67,7 @@ extern "C" { * 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 @@ -76,7 +77,7 @@ extern "C" { * 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. @@ -86,8 +87,8 @@ extern "C" { * 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 @@ -97,8 +98,8 @@ extern "C" { * 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 @@ -108,7 +109,7 @@ extern "C" { * 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. @@ -118,9 +119,9 @@ extern "C" { * 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 */ |