From 5fdfb8630db19278f469e6151bc600bd514ba965 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 25 Feb 2026 09:06:10 -0800 Subject: [PATCH 1/2] 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 --- Changes.md | 6 ++++++ src/maxminddb.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Changes.md b/Changes.md index 97d11180..29591851 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,9 @@ +## 1.13.2 - 2026-02-25 + +- Fixed a compilation failure on macOS 26 (Tahoe) where `sys/endian.h` defines + `bswap32` and `bswap64` as macros, conflicting with our function declarations. + Reported by Anton Melnikov. GitHub #419. + ## 1.13.1 - 2026-02-24 - Re-release for Ubuntu PPA. No code changes. diff --git a/src/maxminddb.c b/src/maxminddb.c index 925acde9..66b69be2 100644 --- a/src/maxminddb.c +++ b/src/maxminddb.c @@ -1804,7 +1804,7 @@ static int get_entry_data_list(const MMDB_s *const mmdb, #define __has_builtin(x) 0 #endif -static inline uint32_t bswap32(uint32_t x) { +static inline uint32_t mmdb_bswap32(uint32_t x) { #if defined(_MSC_VER) return _byteswap_ulong(x); #elif __has_builtin(__builtin_bswap32) @@ -1815,7 +1815,7 @@ static inline uint32_t bswap32(uint32_t x) { #endif } -static inline uint64_t bswap64(uint64_t x) { +static inline uint64_t mmdb_bswap64(uint64_t x) { #if defined(_MSC_VER) return _byteswap_uint64(x); #elif __has_builtin(__builtin_bswap64) @@ -1837,7 +1837,7 @@ static float get_ieee754_float(const uint8_t *restrict p) { memcpy(&i, p, sizeof(uint32_t)); #if MMDB_LITTLE_ENDIAN - i = bswap32(i); + i = mmdb_bswap32(i); #endif memcpy(&f, &i, sizeof(float)); @@ -1852,7 +1852,7 @@ static double get_ieee754_double(const uint8_t *restrict p) { memcpy(&i, p, sizeof(uint64_t)); #if MMDB_LITTLE_ENDIAN - i = bswap64(i); + i = mmdb_bswap64(i); #endif memcpy(&d, &i, sizeof(double)); From f2d236a4a1f0144a285c76b4cf7840dc922e282c Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 25 Feb 2026 09:20:20 -0800 Subject: [PATCH 2/2] Bumped version to 1.13.2 --- CMakeLists.txt | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eff066a..8263aa4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.9...3.30) project(maxminddb LANGUAGES C - VERSION 1.13.1 + VERSION 1.13.2 ) set(MAXMINDDB_SOVERSION 0.0.7) set(CMAKE_C_STANDARD 99) diff --git a/configure.ac b/configure.ac index 54b5ecd9..f35c3401 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.63]) -AC_INIT([libmaxminddb], [1.13.1], [support@maxmind.com]) +AC_INIT([libmaxminddb], [1.13.2], [support@maxmind.com]) AC_CONFIG_SRCDIR([include/maxminddb.h]) AC_CONFIG_HEADERS([config.h include/maxminddb_config.h])