From d9171a11cfd8d1109f6c02cbafde2cacb76400a7 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sat, 21 Sep 2019 18:25:01 -0300 Subject: [PATCH] Fixed some include guards for cmc_hashtable_primes and cmc_entry_state Also removed unnecessary typedef for enum cmc_entry_state Now cmc_entry state is in another guard, separated from the cmc_hashtable_primes guard --- src/cmc/hashmap.h | 15 ++++++++++----- src/cmc/hashset.h | 15 ++++++++++----- src/ext/multimap.h | 6 +++--- src/ext/multiset.h | 15 ++++++++++----- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/cmc/hashmap.h b/src/cmc/hashmap.h index bb56435..849bb65 100644 --- a/src/cmc/hashmap.h +++ b/src/cmc/hashmap.h @@ -29,15 +29,20 @@ /* to_string format */ static const char *cmc_string_fmt_hashmap = "%s at %p { buffer:%p, capacity:%" PRIuMAX ", count:%" PRIuMAX ", load:%lf, cmp:%p, hash:%p }"; -#ifndef CMC_HASH_TABLE_SETUP -#define CMC_HASH_TABLE_SETUP +#ifndef CMC_IMPL_HASHTABLE_STATE +#define CMC_IMPL_HASHTABLE_STATE -typedef enum cmc_entry_state_e +enum cmc_entry_state_e { CMC_ES_DELETED = -1, CMC_ES_EMPTY = 0, CMC_ES_FILLED = 1 -} cmc_entry_state; +}; + +#endif /* CMC_IMPL_HASHTABLE_STATE */ + +#ifndef CMC_IMPL_HASHTABLE_SETUP +#define CMC_IMPL_HASHTABLE_SETUP static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 3067, 6143, 12289, 24571, 49157, @@ -71,7 +76,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 6917529027641081903, 13835058055282163729llu}; -#endif /* CMC_HASH_TABLE_SETUP */ +#endif /* CMC_IMPL_HASHTABLE_SETUP */ #define CMC_GENERATE_HASHMAP(PFX, SNAME, K, V) \ CMC_GENERATE_HASHMAP_HEADER(PFX, SNAME, K, V) \ diff --git a/src/cmc/hashset.h b/src/cmc/hashset.h index 38720d4..19b7171 100644 --- a/src/cmc/hashset.h +++ b/src/cmc/hashset.h @@ -28,15 +28,20 @@ /* to_string format */ static const char *cmc_string_fmt_hashset = "%s at %p { buffer:%p, capacity:%" PRIuMAX ", count:%" PRIuMAX ", load:%lf, cmp:%p, hash:%p }"; -#ifndef CMC_HASH_TABLE_SETUP -#define CMC_HASH_TABLE_SETUP +#ifndef CMC_IMPL_HASHTABLE_STATE +#define CMC_IMPL_HASHTABLE_STATE -typedef enum cmc_entry_state_e +enum cmc_entry_state_e { CMC_ES_DELETED = -1, CMC_ES_EMPTY = 0, CMC_ES_FILLED = 1 -} cmc_entry_state; +}; + +#endif /* CMC_IMPL_HASHTABLE_STATE */ + +#ifndef CMC_IMPL_HASHTABLE_SETUP +#define CMC_IMPL_HASHTABLE_SETUP static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 3067, 6143, 12289, 24571, 49157, @@ -70,7 +75,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 6917529027641081903, 13835058055282163729llu}; -#endif /* CMC_HASH_TABLE_SETUP */ +#endif /* CMC_IMPL_HASHTABLE_SETUP */ #define CMC_GENERATE_HASHSET(PFX, SNAME, V) \ CMC_GENERATE_HASHSET_HEADER(PFX, SNAME, V) \ diff --git a/src/ext/multimap.h b/src/ext/multimap.h index 04cda39..65c6266 100644 --- a/src/ext/multimap.h +++ b/src/ext/multimap.h @@ -53,8 +53,8 @@ /* to_string format */ static const char *cmc_string_fmt_multimap = "%s at %p { buffer:%p, capacity:%" PRIuMAX ", count:%" PRIuMAX ", load:%lf, cmp:%p, hash:%p }"; -#ifndef CMC_HASH_TABLE_SETUP -#define CMC_HASH_TABLE_SETUP +#ifndef CMC_IMPL_HASHTABLE_SETUP +#define CMC_IMPL_HASHTABLE_SETUP static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 3067, 6143, 12289, 24571, 49157, @@ -88,7 +88,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 6917529027641081903, 13835058055282163729llu}; -#endif /* CMC_HASH_TABLE_SETUP */ +#endif /* CMC_IMPL_HASHTABLE_SETUP */ #define CMC_GENERATE_MULTIMAP(PFX, SNAME, K, V) \ CMC_GENERATE_MULTIMAP_HEADER(PFX, SNAME, K, V) \ diff --git a/src/ext/multiset.h b/src/ext/multiset.h index d33ec8f..90bc885 100644 --- a/src/ext/multiset.h +++ b/src/ext/multiset.h @@ -31,15 +31,20 @@ /* to_string format */ static const char *cmc_string_fmt_multiset = "%s at %p { buffer:%p, capacity:%" PRIuMAX ", count:%" PRIuMAX ", cardinality:%" PRIuMAX ", load:%lf, cmp:%p, hash:%p }"; -#ifndef CMC_HASH_TABLE_SETUP -#define CMC_HASH_TABLE_SETUP +#ifndef CMC_IMPL_HASHTABLE_STATE +#define CMC_IMPL_HASHTABLE_STATE -typedef enum cmc_entry_state_e +enum cmc_entry_state_e { CMC_ES_DELETED = -1, CMC_ES_EMPTY = 0, CMC_ES_FILLED = 1 -} cmc_entry_state; +}; + +#endif /* CMC_IMPL_HASHTABLE_STATE */ + +#ifndef CMC_IMPL_HASHTABLE_SETUP +#define CMC_IMPL_HASHTABLE_SETUP static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 3067, 6143, 12289, 24571, 49157, @@ -73,7 +78,7 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531, 6917529027641081903, 13835058055282163729llu}; -#endif /* CMC_HASH_TABLE_SETUP */ +#endif /* CMC_IMPL_HASHTABLE_SETUP */ #define CMC_GENERATE_MULTISET(PFX, SNAME, V) \ CMC_GENERATE_MULTISET_HEADER(PFX, SNAME, V) \