diff --git a/xmalloc.c b/xmalloc.c index c90b97dc..a9a6685c 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "xmalloc.h" @@ -54,6 +55,12 @@ xstrdup(const char *str) return check_alloc(strdup(str)); } +wchar_t * +xwcsdup(const wchar_t *str) +{ + return check_alloc(wcsdup(str)); +} + char * xstrndup(const char *str, size_t n) { diff --git a/xmalloc.h b/xmalloc.h index 2c12cf0a..13d69ca4 100644 --- a/xmalloc.h +++ b/xmalloc.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "macros.h" void *xmalloc(size_t size) XMALLOC; @@ -9,3 +10,4 @@ void *xrealloc(void *ptr, size_t size); char *xstrdup(const char *str) XSTRDUP; char *xstrndup(const char *str, size_t n) XSTRDUP; char *xasprintf(const char *format, ...) PRINTF(1) XMALLOC; +wchar_t *xwcsdup(const wchar_t *str) XSTRDUP;