Commit b81a5718 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

dnsapi: Use the strdup and wcsdup functions instead of reimplementing them.

parent 7f01fdb6
......@@ -25,33 +25,6 @@
#include "winternl.h"
#include "wine/unixlib.h"
static inline char *strdup_a( const char *src )
{
char *dst;
if (!src) return NULL;
dst = malloc( (lstrlenA( src ) + 1) * sizeof(char) );
if (dst) lstrcpyA( dst, src );
return dst;
}
static inline char *strdup_u( const char *src )
{
char *dst;
if (!src) return NULL;
dst = malloc( (strlen( src ) + 1) * sizeof(char) );
if (dst) strcpy( dst, src );
return dst;
}
static inline WCHAR *strdup_w( const WCHAR *src )
{
WCHAR *dst;
if (!src) return NULL;
dst = malloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
if (dst) lstrcpyW( dst, src );
return dst;
}
static inline WCHAR *strdup_aw( const char *str )
{
WCHAR *ret = NULL;
......
......@@ -73,7 +73,7 @@ static DNS_STATUS do_query_netbios( PCSTR name, DNS_RECORDA **recp )
}
else
{
record->pName = strdup_u( name );
record->pName = strdup( name );
if (!record->pName)
{
status = ERROR_NOT_ENOUGH_MEMORY;
......
......@@ -455,7 +455,7 @@ static LPVOID strdupX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
{
switch (out)
{
case DnsCharSetUnicode: return strdup_w( src );
case DnsCharSetUnicode: return wcsdup( src );
case DnsCharSetUtf8: return strdup_wu( src );
case DnsCharSetAnsi: return strdup_wa( src );
default:
......@@ -468,7 +468,7 @@ static LPVOID strdupX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
switch (out)
{
case DnsCharSetUnicode: return strdup_uw( src );
case DnsCharSetUtf8: return strdup_u( src );
case DnsCharSetUtf8: return strdup( src );
case DnsCharSetAnsi: return strdup_ua( src );
default:
WARN( "unhandled target charset: %d\n", out );
......@@ -480,7 +480,7 @@ static LPVOID strdupX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
{
case DnsCharSetUnicode: return strdup_aw( src );
case DnsCharSetUtf8: return strdup_au( src );
case DnsCharSetAnsi: return strdup_a( src );
case DnsCharSetAnsi: return strdup( src );
default:
WARN( "unhandled target charset: %d\n", out );
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment