diff -r fd948e5af26e -r 2cbdb482d325 src/buffer.c --- a/src/buffer.c Thu Dec 04 18:57:54 2025 +0100 +++ b/src/buffer.c Fri Dec 05 16:11:39 2025 +0100 @@ -32,35 +32,6 @@ #include #include -#ifdef _WIN32 -#include -#include -static unsigned long system_page_size(void) { - static unsigned long ps = 0; - if (ps == 0) { - SYSTEM_INFO sysinfo; - GetSystemInfo(&sysinfo); - ps = sysinfo.dwPageSize; - } - return ps; -} -#else -#include -static unsigned long system_page_size(void) { - static unsigned long ps = 0; - if (ps == 0) { - long sc = sysconf(_SC_PAGESIZE); - if (sc < 0) { - // fallback for systems which do not report a value here - ps = 4096; // LCOV_EXCL_LINE - } else { - ps = (unsigned long) sc; - } - } - return ps; -} -#endif - static int buffer_copy_on_write(CxBuffer* buffer) { if (0 == (buffer->flags & CX_BUFFER_COPY_ON_WRITE)) return 0; void *newspace = cxMalloc(buffer->allocator, buffer->capacity); @@ -262,7 +233,7 @@ } static size_t cx_buffer_calculate_minimum_capacity(size_t mincap) { - unsigned long pagesize = system_page_size(); + unsigned long pagesize = cx_system_page_size(); // if page size is larger than 64 KB - for some reason - truncate to 64 KB if (pagesize > 65536) pagesize = 65536; if (mincap < pagesize) {