From f2f5ec844d96fe0007a47e4df00499ab5598b41f Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 23 Nov 2018 19:27:09 +0100 Subject: khash: move khash include into implementation files The current map implementations directly include the "khash.h" headers into their own headers to make available a set of static functions, defines et cetera. Besides leaking the complete khash namespace into files wherever khashes are used, this also triggers Clang's -Wunused-function warnings when some of the static functions are not being used at all. Fix the issue by moving the includes into the respective map implementation files. Add forward declares for all the map types to make them known. --- src/idxmap.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/idxmap.c') diff --git a/src/idxmap.c b/src/idxmap.c index 45f0c2204..05a7b2feb 100644 --- a/src/idxmap.c +++ b/src/idxmap.c @@ -7,6 +7,16 @@ #include "idxmap.h" +#define kmalloc git__malloc +#define kcalloc git__calloc +#define krealloc git__realloc +#define kreallocarray git__reallocarray +#define kfree git__free +#include "khash.h" + +__KHASH_TYPE(idx, const git_index_entry *, git_index_entry *) +__KHASH_TYPE(idxicase, const git_index_entry *, git_index_entry *) + /* This is __ac_X31_hash_string but with tolower and it takes the entry's stage into account */ static kh_inline khint_t idxentry_hash(const git_index_entry *e) { @@ -104,11 +114,21 @@ void git_idxmap_free(git_idxmap *map) kh_destroy(idx, map); } +void git_idxmap_icase_free(git_idxmap_icase *map) +{ + kh_destroy(idxicase, map); +} + void git_idxmap_clear(git_idxmap *map) { kh_clear(idx, map); } +void git_idxmap_icase_clear(git_idxmap_icase *map) +{ + kh_clear(idxicase, map); +} + void git_idxmap_delete_at(git_idxmap *map, size_t idx) { kh_del(idx, map, idx); -- cgit v1.2.1