From 554544276a604c144df45efcb060c80aa322088c Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Mon, 29 Apr 2019 04:28:14 -0400 Subject: *.[ch]: remove extern from function declarations using spatch There has been a push to remove extern from function declarations. Remove some instances of "extern" for function declarations which are caught by Coccinelle. Note that Coccinelle has some difficulty with processing functions with `__attribute__` or varargs so some `extern` declarations are left behind to be dealt with in a future patch. This was the Coccinelle patch used: @@ type T; identifier f; @@ - extern T f(...); and it was run with: $ git ls-files \*.{c,h} | grep -v ^compat/ | xargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place Files under `compat/` are intentionally excluded as some are directly copied from external sources and we should avoid churning them as much as possible. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- hashmap.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'hashmap.h') 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)); -- cgit v1.2.3