Fix b(w)strdup_n returning NULL for empty strings

master
Palana 2014-06-25 23:15:55 +02:00
parent 2ea50cab36
commit 603c87cd8f
1 changed files with 2 additions and 2 deletions

View File

@ -54,7 +54,7 @@ static inline void *bzalloc(size_t size)
static inline char *bstrdup_n(const char *str, size_t n)
{
char *dup;
if (!str || !*str)
if (!str)
return NULL;
dup = (char*)bmemdup(str, n+1);
@ -66,7 +66,7 @@ static inline char *bstrdup_n(const char *str, size_t n)
static inline wchar_t *bwstrdup_n(const wchar_t *str, size_t n)
{
wchar_t *dup;
if (!str || (!*str && n > 0))
if (!str)
return NULL;
dup = (wchar_t*)bmemdup(str, (n+1) * sizeof(wchar_t));