X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=hashmap.h;h=f95593b6cfd7cecfbcc4584d74ac040cb355c767;hb=4a787f72f504ae1429f24997a09ad6bac5cb4332;hp=d375d9cce779952057e3c5dc6340edd12fb3f99d;hpb=1638a625ca836605991f663cfcae4ca1ad542480;p=thirdparty%2Fgit.git diff --git a/hashmap.h b/hashmap.h index d375d9cce7..f95593b6cf 100644 --- a/hashmap.h +++ b/hashmap.h @@ -104,11 +104,11 @@ * `memihash_cont` is a variant of `memihash` that allows a computation to be * continued with another chunk of data. */ -extern unsigned int strhash(const char *buf); -extern unsigned int strihash(const char *buf); -extern unsigned int memhash(const void *buf, size_t len); -extern unsigned int memihash(const void *buf, size_t len); -extern unsigned int memihash_cont(unsigned int hash_seed, const void *buf, size_t len); +unsigned int strhash(const char *buf); +unsigned int strihash(const char *buf); +unsigned int memhash(const void *buf, size_t len); +unsigned int memihash(const void *buf, size_t len); +unsigned int memihash_cont(unsigned int hash_seed, const void *buf, size_t len); /* * Converts a cryptographic hash (e.g. SHA-1) into an int-sized hash code @@ -216,7 +216,7 @@ struct hashmap { * parameter may be used to preallocate a sufficiently large table and thus * prevent expensive resizing. If 0, the table is dynamically resized. */ -extern void hashmap_init(struct hashmap *map, +void hashmap_init(struct hashmap *map, hashmap_cmp_fn equals_function, const void *equals_function_data, size_t initial_size); @@ -227,7 +227,7 @@ extern void hashmap_init(struct hashmap *map, * If `free_entries` is true, each hashmap_entry in the map is freed as well * using stdlibs free(). */ -extern void hashmap_free(struct hashmap *map, int free_entries); +void hashmap_free(struct hashmap *map, int free_entries); /* hashmap_entry functions */ @@ -284,7 +284,7 @@ static inline unsigned int hashmap_get_size(struct hashmap *map) * If an entry with matching hash code is found, `key` and `keydata` are passed * to `hashmap_cmp_fn` to decide whether the entry matches the key. */ -extern void *hashmap_get(const struct hashmap *map, const void *key, +void *hashmap_get(const struct hashmap *map, const void *key, const void *keydata); /* @@ -316,7 +316,7 @@ static inline void *hashmap_get_from_hash(const struct hashmap *map, * `entry` is the hashmap_entry to start the search from, obtained via a previous * call to `hashmap_get` or `hashmap_get_next`. */ -extern void *hashmap_get_next(const struct hashmap *map, const void *entry); +void *hashmap_get_next(const struct hashmap *map, const void *entry); /* * Adds a hashmap entry. This allows to add duplicate entries (i.e. @@ -325,7 +325,7 @@ extern void *hashmap_get_next(const struct hashmap *map, const void *entry); * `map` is the hashmap structure. * `entry` is the entry to add. */ -extern void hashmap_add(struct hashmap *map, void *entry); +void hashmap_add(struct hashmap *map, void *entry); /* * Adds or replaces a hashmap entry. If the hashmap contains duplicate @@ -335,7 +335,7 @@ extern void hashmap_add(struct hashmap *map, void *entry); * `entry` is the entry to add or replace. * Returns the replaced entry, or NULL if not found (i.e. the entry was added). */ -extern void *hashmap_put(struct hashmap *map, void *entry); +void *hashmap_put(struct hashmap *map, void *entry); /* * Removes a hashmap entry matching the specified key. If the hashmap contains @@ -344,7 +344,7 @@ extern void *hashmap_put(struct hashmap *map, void *entry); * * Argument explanation is the same as in `hashmap_get`. */ -extern void *hashmap_remove(struct hashmap *map, const void *key, +void *hashmap_remove(struct hashmap *map, const void *key, const void *keydata); /* @@ -365,10 +365,10 @@ struct hashmap_iter { }; /* Initializes a `hashmap_iter` structure. */ -extern void hashmap_iter_init(struct hashmap *map, struct hashmap_iter *iter); +void hashmap_iter_init(struct hashmap *map, struct hashmap_iter *iter); /* Returns the next hashmap_entry, or NULL if there are no more entries. */ -extern void *hashmap_iter_next(struct hashmap_iter *iter); +void *hashmap_iter_next(struct hashmap_iter *iter); /* Initializes the iterator and returns the first entry, if any. */ static inline void *hashmap_iter_first(struct hashmap *map, @@ -429,7 +429,7 @@ static inline void hashmap_enable_item_counting(struct hashmap *map) * * Uses a hashmap to store the pool of interned strings. */ -extern const void *memintern(const void *data, size_t len); +const void *memintern(const void *data, size_t len); static inline const char *strintern(const char *string) { return memintern(string, strlen(string));