clang does not like _strdup

This commit is contained in:
Caelan Sayler
2024-10-20 01:51:40 +01:00
committed by Caelan
parent 1ce12b8b84
commit 9ae6427862

View File

@@ -30,12 +30,16 @@ static inline StringOption to_bridgestring_opt(const char* psz) {
} }
static inline void allocate_string(::rust::String& str, char** ppsz) { static inline void allocate_string(::rust::String& str, char** ppsz) {
#ifdef _WIN32
*ppsz = _strdup(str.c_str()); *ppsz = _strdup(str.c_str());
#else
*ppsz = strdup(str.c_str());
#endif
} }
static inline void allocate_string_opt(StringOption str, char** ppsz) { static inline void allocate_string_opt(StringOption str, char** ppsz) {
if (str.has_data) { if (str.has_data) {
*ppsz = _strdup(str.data.c_str()); allocate_string(str.data, ppsz);
} else { } else {
*ppsz = nullptr; *ppsz = nullptr;
} }