Skip to content

Commit b9fc547

Browse files
oschwaldclaude
andcommitted
Rename bswap32/bswap64 to mmdb_bswap32/mmdb_bswap64
On macOS 26, sys/endian.h defines bswap32 and bswap64 as macros. Since maxminddb.h includes sys/endian.h when available, our static inline function declarations collide with those macros, causing a compilation failure. Rename to mmdb_bswap32/mmdb_bswap64 to avoid the namespace collision entirely. These are internal static functions so the rename is safe. Fixes #419 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 115ce93 commit b9fc547

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/maxminddb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ static int get_entry_data_list(const MMDB_s *const mmdb,
18041804
#define __has_builtin(x) 0
18051805
#endif
18061806

1807-
static inline uint32_t bswap32(uint32_t x) {
1807+
static inline uint32_t mmdb_bswap32(uint32_t x) {
18081808
#if defined(_MSC_VER)
18091809
return _byteswap_ulong(x);
18101810
#elif __has_builtin(__builtin_bswap32)
@@ -1815,7 +1815,7 @@ static inline uint32_t bswap32(uint32_t x) {
18151815
#endif
18161816
}
18171817

1818-
static inline uint64_t bswap64(uint64_t x) {
1818+
static inline uint64_t mmdb_bswap64(uint64_t x) {
18191819
#if defined(_MSC_VER)
18201820
return _byteswap_uint64(x);
18211821
#elif __has_builtin(__builtin_bswap64)
@@ -1837,7 +1837,7 @@ static float get_ieee754_float(const uint8_t *restrict p) {
18371837
memcpy(&i, p, sizeof(uint32_t));
18381838

18391839
#if MMDB_LITTLE_ENDIAN
1840-
i = bswap32(i);
1840+
i = mmdb_bswap32(i);
18411841
#endif
18421842

18431843
memcpy(&f, &i, sizeof(float));
@@ -1852,7 +1852,7 @@ static double get_ieee754_double(const uint8_t *restrict p) {
18521852
memcpy(&i, p, sizeof(uint64_t));
18531853

18541854
#if MMDB_LITTLE_ENDIAN
1855-
i = bswap64(i);
1855+
i = mmdb_bswap64(i);
18561856
#endif
18571857

18581858
memcpy(&d, &i, sizeof(double));

0 commit comments

Comments
 (0)