diff options
author | Max Kellermann <max@duempel.org> | 2015-01-26 20:57:29 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-01-26 20:57:29 +0100 |
commit | ae7e1a22cb3bc6029a6f270c3a68a139dfa86085 (patch) | |
tree | e4c11d3d2f125222b498005fcb6365ea94e53f9b /src/util | |
parent | 16944b53973cb52f343eda947262bf7a968b1953 (diff) | |
parent | a289dcb9ee6d7992a21f24b99be667eed6c32321 (diff) | |
download | mpd-ae7e1a22cb3bc6029a6f270c3a68a139dfa86085.tar.gz mpd-ae7e1a22cb3bc6029a6f270c3a68a139dfa86085.tar.xz mpd-ae7e1a22cb3bc6029a6f270c3a68a139dfa86085.zip |
Merge branch 'v0.19.x'
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Alloc.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/util/Alloc.cxx b/src/util/Alloc.cxx index d4941f88b..c2676ca3d 100644 --- a/src/util/Alloc.cxx +++ b/src/util/Alloc.cxx @@ -17,6 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include "Alloc.hxx" #include <stdlib.h> @@ -62,14 +63,14 @@ xstrdup(const char *s) char * xstrndup(const char *s, size_t n) { -#ifdef WIN32 - char *p = (char *)xalloc(n + 1); - memcpy(p, s, n); - p[n] = 0; -#else +#ifdef HAVE_STRNDUP char *p = strndup(s, n); if (gcc_unlikely(p == nullptr)) oom(); +#else + char *p = (char *)xalloc(n + 1); + memcpy(p, s, n); + p[n] = 0; #endif return p; |