dnsapi: Rename the wrappers around HeapAlloc() &Co to use the new standard naming.
This commit is contained in:
parent
ac527f1e6c
commit
b3ff6803c0
|
@ -19,19 +19,19 @@
|
|||
*/
|
||||
|
||||
|
||||
static inline void *dns_alloc( SIZE_T size )
|
||||
static inline void *heap_alloc( SIZE_T size )
|
||||
{
|
||||
return HeapAlloc( GetProcessHeap(), 0, size );
|
||||
}
|
||||
|
||||
static inline void *dns_zero_alloc( SIZE_T size )
|
||||
static inline void *heap_alloc_zero( SIZE_T size )
|
||||
{
|
||||
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
|
||||
}
|
||||
|
||||
static inline void dns_free( LPVOID mem )
|
||||
static inline BOOL heap_free( LPVOID mem )
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, mem );
|
||||
return HeapFree( GetProcessHeap(), 0, mem );
|
||||
}
|
||||
|
||||
static inline LPSTR dns_strdup_a( LPCSTR src )
|
||||
|
@ -39,7 +39,7 @@ static inline LPSTR dns_strdup_a( LPCSTR src )
|
|||
LPSTR dst;
|
||||
|
||||
if (!src) return NULL;
|
||||
dst = dns_alloc( (lstrlenA( src ) + 1) * sizeof(char) );
|
||||
dst = heap_alloc( (lstrlenA( src ) + 1) * sizeof(char) );
|
||||
if (dst) lstrcpyA( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static inline char *dns_strdup_u( const char *src )
|
|||
char *dst;
|
||||
|
||||
if (!src) return NULL;
|
||||
dst = dns_alloc( (strlen( src ) + 1) * sizeof(char) );
|
||||
dst = heap_alloc( (strlen( src ) + 1) * sizeof(char) );
|
||||
if (dst) strcpy( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ static inline LPWSTR dns_strdup_w( LPCWSTR src )
|
|||
LPWSTR dst;
|
||||
|
||||
if (!src) return NULL;
|
||||
dst = dns_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
|
||||
dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
|
||||
if (dst) lstrcpyW( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ static inline LPWSTR dns_strdup_aw( LPCSTR str )
|
|||
if (str)
|
||||
{
|
||||
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
||||
if ((ret = dns_alloc( len * sizeof(WCHAR) )))
|
||||
if ((ret = heap_alloc( len * sizeof(WCHAR) )))
|
||||
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
|
||||
}
|
||||
return ret;
|
||||
|
@ -82,7 +82,7 @@ static inline LPWSTR dns_strdup_uw( const char *str )
|
|||
if (str)
|
||||
{
|
||||
DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
|
||||
if ((ret = dns_alloc( len * sizeof(WCHAR) )))
|
||||
if ((ret = heap_alloc( len * sizeof(WCHAR) )))
|
||||
MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
|
||||
}
|
||||
return ret;
|
||||
|
@ -94,7 +94,7 @@ static inline LPSTR dns_strdup_wa( LPCWSTR str )
|
|||
if (str)
|
||||
{
|
||||
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
if ((ret = dns_alloc( len )))
|
||||
if ((ret = heap_alloc( len )))
|
||||
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
|
||||
}
|
||||
return ret;
|
||||
|
@ -106,7 +106,7 @@ static inline char *dns_strdup_wu( LPCWSTR str )
|
|||
if (str)
|
||||
{
|
||||
DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
if ((ret = dns_alloc( len )))
|
||||
if ((ret = heap_alloc( len )))
|
||||
WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
|
||||
}
|
||||
return ret;
|
||||
|
@ -120,7 +120,7 @@ static inline char *dns_strdup_au( LPCSTR src )
|
|||
if (ret)
|
||||
{
|
||||
dst = dns_strdup_wu( ret );
|
||||
dns_free( ret );
|
||||
heap_free( ret );
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ static inline LPSTR dns_strdup_ua( const char *src )
|
|||
if (ret)
|
||||
{
|
||||
dst = dns_strdup_wa( ret );
|
||||
dns_free( ret );
|
||||
heap_free( ret );
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ BOOL WINAPI DnsNameCompare_A( PCSTR name1, PCSTR name2 )
|
|||
|
||||
ret = DnsNameCompare_W( name1W, name2W );
|
||||
|
||||
dns_free( name1W );
|
||||
dns_free( name2W );
|
||||
heap_free( name1W );
|
||||
heap_free( name2W );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ DNS_STATUS WINAPI DnsValidateName_A( PCSTR name, DNS_NAME_FORMAT format )
|
|||
nameW = dns_strdup_aw( name );
|
||||
ret = DnsValidateName_W( nameW, format );
|
||||
|
||||
dns_free( nameW );
|
||||
heap_free( nameW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ DNS_STATUS WINAPI DnsValidateName_UTF8( PCSTR name, DNS_NAME_FORMAT format )
|
|||
nameW = dns_strdup_uw( name );
|
||||
ret = DnsValidateName_W( nameW, format );
|
||||
|
||||
dns_free( nameW );
|
||||
heap_free( nameW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ static char *dns_dname_from_msg( ns_msg msg, const unsigned char *pos )
|
|||
pos, dname, sizeof(dname) );
|
||||
|
||||
len = strlen( dname );
|
||||
str = dns_alloc( len + 1 );
|
||||
str = heap_alloc( len + 1 );
|
||||
if (str) strcpy( str, dname );
|
||||
return str;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ static char *dns_str_from_rdata( const unsigned char *rdata )
|
|||
char *str;
|
||||
unsigned int len = rdata[0];
|
||||
|
||||
str = dns_alloc( len + 1 );
|
||||
str = heap_alloc( len + 1 );
|
||||
if (str)
|
||||
{
|
||||
memcpy( str, ++rdata, len );
|
||||
|
@ -302,7 +302,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
r->Data.MINFO.pNameErrorsMailbox = dns_dname_from_msg( msg, pos );
|
||||
if (!r->Data.MINFO.pNameErrorsMailbox)
|
||||
{
|
||||
dns_free( r->Data.MINFO.pNameMailbox );
|
||||
heap_free( r->Data.MINFO.pNameMailbox );
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
r->Data.SOA.pNameAdministrator = dns_dname_from_msg( msg, pos );
|
||||
if (!r->Data.SOA.pNameAdministrator)
|
||||
{
|
||||
dns_free( r->Data.SOA.pNamePrimaryServer );
|
||||
heap_free( r->Data.SOA.pNamePrimaryServer );
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
|
|||
r->Data.TXT.pStringArray[i] = dns_str_from_rdata( pos );
|
||||
if (!r->Data.TXT.pStringArray[i])
|
||||
{
|
||||
while (i > 0) dns_free( r->Data.TXT.pStringArray[--i] );
|
||||
while (i > 0) heap_free( r->Data.TXT.pStringArray[--i] );
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
i++;
|
||||
|
@ -455,13 +455,13 @@ static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
|
|||
if (dns_ns_parserr( &msg, section, num, &rr ) < 0)
|
||||
return DNS_ERROR_BAD_PACKET;
|
||||
|
||||
if (!(record = dns_zero_alloc( dns_get_record_size( &rr ) )))
|
||||
if (!(record = heap_alloc_zero( dns_get_record_size( &rr ) )))
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
record->pName = dns_strdup_u( rr.name );
|
||||
if (!record->pName)
|
||||
{
|
||||
dns_free( record );
|
||||
heap_free( record );
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -472,8 +472,8 @@ static DNS_STATUS dns_copy_record( ns_msg msg, ns_sect section,
|
|||
|
||||
if ((ret = dns_copy_rdata( msg, &rr, record, &dlen )))
|
||||
{
|
||||
dns_free( record->pName );
|
||||
dns_free( record );
|
||||
heap_free( record->pName );
|
||||
heap_free( record );
|
||||
return ret;
|
||||
}
|
||||
record->wDataLength = dlen;
|
||||
|
@ -517,7 +517,7 @@ static DNS_STATUS dns_do_query_netbios( PCSTR name, DNS_RECORDA **recp )
|
|||
|
||||
for (i = 0; i < header->node_count; i++)
|
||||
{
|
||||
record = dns_zero_alloc( sizeof(DNS_RECORDA) );
|
||||
record = heap_alloc_zero( sizeof(DNS_RECORDA) );
|
||||
if (!record)
|
||||
{
|
||||
status = ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
@ -687,7 +687,7 @@ DNS_STATUS WINAPI DnsQuery_A( PCSTR name, WORD type, DWORD options, PVOID server
|
|||
DnsRecordListFree( (DNS_RECORD *)resultW, DnsFreeRecordList );
|
||||
}
|
||||
|
||||
dns_free( nameW );
|
||||
heap_free( nameW );
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -764,7 +764,7 @@ DNS_STATUS WINAPI DnsQuery_W( PCWSTR name, WORD type, DWORD options, PVOID serve
|
|||
DnsRecordListFree( (DNS_RECORD *)resultA, DnsFreeRecordList );
|
||||
}
|
||||
|
||||
dns_free( nameU );
|
||||
heap_free( nameU );
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
TRACE( "(%p,%d,%d)\n", src, in, out );
|
||||
|
||||
size = FIELD_OFFSET(DNS_RECORD, Data) + src->wDataLength;
|
||||
dst = dns_zero_alloc( size );
|
||||
dst = heap_alloc_zero( size );
|
||||
if (!dst) return NULL;
|
||||
|
||||
memcpy( dst, src, size );
|
||||
|
@ -443,7 +443,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
|
||||
if (!dst->Data.TXT.pStringArray[i])
|
||||
{
|
||||
while (i > 0) dns_free( dst->Data.TXT.pStringArray[--i] );
|
||||
while (i > 0) heap_free( dst->Data.TXT.pStringArray[--i] );
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
dns_strcpyX( src->Data.MINFO.pNameErrorsMailbox, in, out );
|
||||
if (!dst->Data.MINFO.pNameErrorsMailbox)
|
||||
{
|
||||
dns_free( dst->Data.MINFO.pNameMailbox );
|
||||
heap_free( dst->Data.MINFO.pNameMailbox );
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
@ -512,7 +512,7 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
dns_strcpyX( src->Data.SOA.pNameAdministrator, in, out );
|
||||
if (!dst->Data.SOA.pNameAdministrator)
|
||||
{
|
||||
dns_free( dst->Data.SOA.pNamePrimaryServer );
|
||||
heap_free( dst->Data.SOA.pNamePrimaryServer );
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
@ -530,8 +530,8 @@ PDNS_RECORD WINAPI DnsRecordCopyEx( PDNS_RECORD src, DNS_CHARSET in, DNS_CHARSET
|
|||
return dst;
|
||||
|
||||
error:
|
||||
dns_free( dst->pName );
|
||||
dns_free( dst );
|
||||
heap_free( dst->pName );
|
||||
heap_free( dst );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,7 @@ VOID WINAPI DnsRecordListFree( PDNS_RECORD list, DNS_FREE_TYPE type )
|
|||
{
|
||||
for (r = list; (list = r); r = next)
|
||||
{
|
||||
dns_free( r->pName );
|
||||
heap_free( r->pName );
|
||||
|
||||
switch (r->wType)
|
||||
{
|
||||
|
@ -564,27 +564,27 @@ VOID WINAPI DnsRecordListFree( PDNS_RECORD list, DNS_FREE_TYPE type )
|
|||
case DNS_TYPE_X25:
|
||||
{
|
||||
for (i = 0; i < r->Data.TXT.dwStringCount; i++)
|
||||
dns_free( r->Data.TXT.pStringArray[i] );
|
||||
heap_free( r->Data.TXT.pStringArray[i] );
|
||||
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_MINFO:
|
||||
case DNS_TYPE_RP:
|
||||
{
|
||||
dns_free( r->Data.MINFO.pNameMailbox );
|
||||
dns_free( r->Data.MINFO.pNameErrorsMailbox );
|
||||
heap_free( r->Data.MINFO.pNameMailbox );
|
||||
heap_free( r->Data.MINFO.pNameErrorsMailbox );
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_AFSDB:
|
||||
case DNS_TYPE_RT:
|
||||
case DNS_TYPE_MX:
|
||||
{
|
||||
dns_free( r->Data.MX.pNameExchange );
|
||||
heap_free( r->Data.MX.pNameExchange );
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_NXT:
|
||||
{
|
||||
dns_free( r->Data.NXT.pNameNext );
|
||||
heap_free( r->Data.NXT.pNameNext );
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_CNAME:
|
||||
|
@ -596,23 +596,23 @@ VOID WINAPI DnsRecordListFree( PDNS_RECORD list, DNS_FREE_TYPE type )
|
|||
case DNS_TYPE_NS:
|
||||
case DNS_TYPE_PTR:
|
||||
{
|
||||
dns_free( r->Data.PTR.pNameHost );
|
||||
heap_free( r->Data.PTR.pNameHost );
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_SIG:
|
||||
{
|
||||
dns_free( r->Data.SIG.pNameSigner );
|
||||
heap_free( r->Data.SIG.pNameSigner );
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_SOA:
|
||||
{
|
||||
dns_free( r->Data.SOA.pNamePrimaryServer );
|
||||
dns_free( r->Data.SOA.pNameAdministrator );
|
||||
heap_free( r->Data.SOA.pNamePrimaryServer );
|
||||
heap_free( r->Data.SOA.pNameAdministrator );
|
||||
break;
|
||||
}
|
||||
case DNS_TYPE_SRV:
|
||||
{
|
||||
dns_free( r->Data.SRV.pNameTarget );
|
||||
heap_free( r->Data.SRV.pNameTarget );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -620,7 +620,7 @@ VOID WINAPI DnsRecordListFree( PDNS_RECORD list, DNS_FREE_TYPE type )
|
|||
}
|
||||
|
||||
next = r->pNext;
|
||||
dns_free( r );
|
||||
heap_free( r );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ BOOL WINAPI DnsRecordSetCompare( PDNS_RECORD set1, PDNS_RECORD set2,
|
|||
DNS_RRSET_ADD( rr1, u );
|
||||
ret = FALSE;
|
||||
}
|
||||
else dns_free( u );
|
||||
else heap_free( u );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,7 +696,7 @@ BOOL WINAPI DnsRecordSetCompare( PDNS_RECORD set1, PDNS_RECORD set2,
|
|||
DNS_RRSET_ADD( rr2, u );
|
||||
ret = FALSE;
|
||||
}
|
||||
else dns_free( u );
|
||||
else heap_free( u );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue