From 9ae64278625cdf9c6eaba0f469b771636e5e95f4 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Sun, 20 Oct 2024 01:51:40 +0100 Subject: [PATCH] clang does not like _strdup --- src/lib-cpp/src/bridge.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib-cpp/src/bridge.cc b/src/lib-cpp/src/bridge.cc index 5ffa207c..dd120b4a 100644 --- a/src/lib-cpp/src/bridge.cc +++ b/src/lib-cpp/src/bridge.cc @@ -30,12 +30,16 @@ static inline StringOption to_bridgestring_opt(const char* psz) { } static inline void allocate_string(::rust::String& str, char** ppsz) { +#ifdef _WIN32 *ppsz = _strdup(str.c_str()); +#else + *ppsz = strdup(str.c_str()); +#endif } static inline void allocate_string_opt(StringOption str, char** ppsz) { if (str.has_data) { - *ppsz = _strdup(str.data.c_str()); + allocate_string(str.data, ppsz); } else { *ppsz = nullptr; }