mirror of
https://github.com/reactos/reactos.git
synced 2024-11-18 21:13:52 +00:00
29fa274d6d
- TSVN choked repeatedly when attempting to merge ~9000 revs into the branch (tried 3 times on 2 different computers) - If someone wants to delete aicom-network-fixes, they are welcome to - Lesson learned: Letting a branch get thousands of revs out of date is a horrible idea svn path=/branches/aicom-network-branch/; revision=44353
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
/*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS DNS Shared Library
|
|
* FILE: lib/dnslib/memory.c
|
|
* PURPOSE: DNS Memory Manager Implementation and Heap.
|
|
*/
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
#include "precomp.h"
|
|
|
|
/* DATA **********************************************************************/
|
|
|
|
typedef PVOID
|
|
(WINAPI *PDNS_ALLOC_FUNCTION)(IN SIZE_T Size);
|
|
typedef VOID
|
|
(WINAPI *PDNS_FREE_FUNCTION)(IN PVOID Buffer);
|
|
|
|
PDNS_ALLOC_FUNCTION pDnsAllocFunction;
|
|
PDNS_FREE_FUNCTION pDnsFreeFunction;
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
VOID
|
|
WINAPI
|
|
Dns_Free(IN PVOID Address)
|
|
{
|
|
/* Check if whoever imported us specified a special free function */
|
|
if (pDnsFreeFunction)
|
|
{
|
|
/* Use it */
|
|
pDnsFreeFunction(Address);
|
|
}
|
|
else
|
|
{
|
|
/* Use our own */
|
|
LocalFree(Address);
|
|
}
|
|
}
|
|
|
|
PVOID
|
|
WINAPI
|
|
Dns_AllocZero(IN SIZE_T Size)
|
|
{
|
|
PVOID Buffer;
|
|
|
|
/* Check if whoever imported us specified a special allocation function */
|
|
if (pDnsAllocFunction)
|
|
{
|
|
/* Use it to allocate the memory */
|
|
Buffer = pDnsAllocFunction(Size);
|
|
if (Buffer)
|
|
{
|
|
/* Zero it out */
|
|
RtlZeroMemory(Buffer, Size);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
/* Use our default */
|
|
Buffer = LocalAlloc(LMEM_ZEROINIT, Size);
|
|
}
|
|
|
|
/* Return the allocate pointer */
|
|
return Buffer;
|
|
}
|
|
|