From ceab718f547359bb09ea2db0b52495b62fbfd529 Mon Sep 17 00:00:00 2001 From: Johannes Holmberg Date: Mon, 27 Jan 2025 19:15:22 +0100 Subject: [PATCH] Guard glibc-specific functions using __GLIBC__ define --- c_src/quicer_nif.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/c_src/quicer_nif.c b/c_src/quicer_nif.c index ac2caf31..6b45bd7f 100644 --- a/c_src/quicer_nif.c +++ b/c_src/quicer_nif.c @@ -17,11 +17,12 @@ limitations under the License. #include "quicer_nif.h" #include +#include #include "quicer_listener.h" #include "quicer_vsn.h" -#if defined(__linux__) +#if defined(__GLIBC__) #include #endif @@ -1701,7 +1702,7 @@ make_event(ErlNifEnv *env, prop); // 4th element, event props :: any()) // } -#if defined(__linux__) +#if defined(__GLIBC__) ERL_NIF_TERM do_malloc_trim(__unused_parm__ ErlNifEnv *env, __unused_parm__ int argc, @@ -1779,7 +1780,7 @@ static ErlNifFunc nif_funcs[] = { { "copy_stream_handle", 1, copy_stream_handle, 0}, /* for testing */ { "mock_buffer_sig", 3, mock_buffer_sig, 0}, -#if defined(__linux__) +#if defined(__GLIBC__) { "malloc_trim", 0, do_malloc_trim, 0}, { "malloc_stats", 0, do_malloc_stats, 0}, #endif