ewah/bitmap: silence warning about MASK macro redefinition

On PowerPC Mac OS X (10.5.8 "Leopard" with Xcode 3.1), system header /usr/include/ppc/param.h[1] pollutes the preprocessor namespace with a macro generically named MASK. This conflicts with the same-named macro in ewah/bitmap.c. We can avoid this conflict by using a more specific name. [1]: Included indirectly via: git-compat-util.h -> sys/sysctl.h -> sys/ucred.h -> sys/param.h -> machine/param.h -> ppc/param.h Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eric Sunshine committed Jun 3, 2015 at 02:39 UTC 414382fb00c72babe2b22ef0fa757ea7c960f5ce
1 file changed +8 -8
ewah/bitmap.c
+8 -8
@@ -20,8 +20,8 @@
20 #include "git-compat-util.h"
21 #include "ewok.h"
22
23 -#define MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
24 -#define BLOCK(x) (x / BITS_IN_WORD)
23 +#define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
24 +#define EWAH_BLOCK(x) (x / BITS_IN_WORD)
25
26 struct bitmap *bitmap_new(void)
27 {
@@ -33,7 +33,7 @@ struct bitmap *bitmap_new(void)
33
34 void bitmap_set(struct bitmap *self, size_t pos)
35 {
36 - size_t block = BLOCK(pos);
36 + size_t block = EWAH_BLOCK(pos);
37
38 if (block >= self->word_alloc) {
39 size_t old_size = self->word_alloc;
@@ -45,22 +45,22 @@ void bitmap_set(struct bitmap *self, size_t pos)
45 (self->word_alloc - old_size) * sizeof(eword_t));
46 }
47
48 - self->words[block] |= MASK(pos);
48 + self->words[block] |= EWAH_MASK(pos);
49 }
50
51 void bitmap_clear(struct bitmap *self, size_t pos)
52 {
53 - size_t block = BLOCK(pos);
53 + size_t block = EWAH_BLOCK(pos);
54
55 if (block < self->word_alloc)
56 - self->words[block] &= ~MASK(pos);
56 + self->words[block] &= ~EWAH_MASK(pos);
57 }
58
59 int bitmap_get(struct bitmap *self, size_t pos)
60 {
61 - size_t block = BLOCK(pos);
61 + size_t block = EWAH_BLOCK(pos);
62 return block < self->word_alloc &&
63 - (self->words[block] & MASK(pos)) != 0;
63 + (self->words[block] & EWAH_MASK(pos)) != 0;
64 }
65
66 struct ewah_bitmap *bitmap_to_ewah(struct bitmap *bitmap)