build-sys: use #if Y instead of #ifdef Y everywhere
The advantage is that is the name is mispellt, cpp will warn us.
$ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/"
$ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;'
$ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g'
$ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g'
+ manual changes to meson.build
squash! build-sys: use #if Y instead of #ifdef Y everywhere
v2:
- fix incorrect setting of HAVE_LIBIDN2
This commit is contained in:
+11
-11
@@ -34,7 +34,7 @@
|
||||
#include "strv.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
#include <pthread.h>
|
||||
#include "list.h"
|
||||
#endif
|
||||
@@ -142,7 +142,7 @@ typedef uint8_t dib_raw_t;
|
||||
|
||||
#define DIB_FREE UINT_MAX
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
struct hashmap_debug_info {
|
||||
LIST_FIELDS(struct hashmap_debug_info, debug_list);
|
||||
unsigned max_entries; /* high watermark of n_entries */
|
||||
@@ -499,7 +499,7 @@ static void base_remove_entry(HashmapBase *h, unsigned idx) {
|
||||
dibs = dib_raw_ptr(h);
|
||||
assert(dibs[idx] != DIB_RAW_FREE);
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
h->debug.rem_count++;
|
||||
h->debug.last_rem_idx = idx;
|
||||
#endif
|
||||
@@ -578,7 +578,7 @@ static unsigned hashmap_iterate_in_insertion_order(OrderedHashmap *h, Iterator *
|
||||
assert(e->p.b.key == i->next_key);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
i->prev_idx = idx;
|
||||
#endif
|
||||
|
||||
@@ -635,7 +635,7 @@ static unsigned hashmap_iterate_in_internal_order(HashmapBase *h, Iterator *i) {
|
||||
}
|
||||
|
||||
idx = i->idx;
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
i->prev_idx = idx;
|
||||
#endif
|
||||
|
||||
@@ -658,7 +658,7 @@ static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) {
|
||||
return IDX_NIL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
if (i->idx == IDX_FIRST) {
|
||||
i->put_count = h->debug.put_count;
|
||||
i->rem_count = h->debug.rem_count;
|
||||
@@ -750,7 +750,7 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu
|
||||
shared_hash_key_initialized= true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
h->debug.func = func;
|
||||
h->debug.file = file;
|
||||
h->debug.line = line;
|
||||
@@ -807,7 +807,7 @@ static void hashmap_free_no_clear(HashmapBase *h) {
|
||||
assert(!h->has_indirect);
|
||||
assert(!h->n_direct_entries);
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0);
|
||||
LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug);
|
||||
assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0);
|
||||
@@ -919,7 +919,7 @@ static bool hashmap_put_robin_hood(HashmapBase *h, unsigned idx,
|
||||
dib_raw_t raw_dib, *dibs;
|
||||
unsigned dib, distance;
|
||||
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
h->debug.put_count++;
|
||||
#endif
|
||||
|
||||
@@ -1012,7 +1012,7 @@ static int hashmap_base_put_boldly(HashmapBase *h, unsigned idx,
|
||||
assert_se(hashmap_put_robin_hood(h, idx, swap) == false);
|
||||
|
||||
n_entries_inc(h);
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
h->debug.max_entries = MAX(h->debug.max_entries, n_entries(h));
|
||||
#endif
|
||||
|
||||
@@ -1240,7 +1240,7 @@ int hashmap_replace(Hashmap *h, const void *key, void *value) {
|
||||
idx = bucket_scan(h, hash, key);
|
||||
if (idx != IDX_NIL) {
|
||||
e = plain_bucket_at(h, idx);
|
||||
#ifdef ENABLE_DEBUG_HASHMAP
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
/* Although the key is equal, the key pointer may have changed,
|
||||
* and this would break our assumption for iterating. So count
|
||||
* this operation as incompatible with iteration. */
|
||||
|
||||
Reference in New Issue
Block a user