tests/test_buffer.c

changeset 1539
2cbdb482d325
parent 1520
03d703c3cfe9
child 1542
197450c2b0b3
--- a/tests/test_buffer.c	Thu Dec 04 18:57:54 2025 +0100
+++ b/tests/test_buffer.c	Fri Dec 05 16:11:39 2025 +0100
@@ -32,35 +32,6 @@
 
 #include "cx/buffer.h"
 
-#ifdef _WIN32
-#include <Windows.h>
-#include <sysinfoapi.h>
-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 <unistd.h>
-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
-
 CX_TEST(test_buffer_init_wrap_space) {
     CxTestingAllocator talloc;
     cx_testing_allocator_init(&talloc);
@@ -234,8 +205,8 @@
         CX_TEST_ASSERT(buf.capacity == 256);
 
         // greater than page size, new capacity should be multiple of pagesize
-        cxBufferMinimumCapacity(&buf, system_page_size() + 200);
-        CX_TEST_ASSERT(buf.capacity == system_page_size()*2);
+        cxBufferMinimumCapacity(&buf, cx_system_page_size() + 200);
+        CX_TEST_ASSERT(buf.capacity == cx_system_page_size()*2);
 
         cxBufferDestroy(&buf);
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));

mercurial