diff --git a/wrappers/native-wrapper.h b/wrappers/native-wrapper.h index 4e2f3f3..1ac87cd 100644 --- a/wrappers/native-wrapper.h +++ b/wrappers/native-wrapper.h @@ -58,7 +58,11 @@ typedef char TCHAR; #endif #ifdef _WIN32 -static inline TCHAR *escape(const TCHAR *str) { +static inline const TCHAR *escape(const TCHAR *str) { + // If we don't need to escape anything, just return the input string + // as is. + if (!_tcschr(str, ' ') && !_tcschr(str, '"')) + return str; TCHAR *out = malloc((_tcslen(str) * 2 + 3) * sizeof(*out)); TCHAR *ptr = out; int i;