ReactOS  0.4.14-dev-999-g61c8d34
memory.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS DNS Shared Library
4  * FILE: lib/dnslib/memory.c
5  * PURPOSE: DNS Memory Manager Implementation and Heap.
6  */
7 
8 /* INCLUDES ******************************************************************/
9 #include "precomp.h"
10 
11 /* DATA **********************************************************************/
12 
13 typedef PVOID
15 typedef VOID
17 
20 
21 /* FUNCTIONS *****************************************************************/
22 
23 VOID
24 WINAPI
26 {
27  /* Check if whoever imported us specified a special free function */
28  if (pDnsFreeFunction)
29  {
30  /* Use it */
32  }
33  else
34  {
35  /* Use our own */
37  }
38 }
39 
40 PVOID
41 WINAPI
43 {
44  PVOID Buffer;
45 
46  /* Check if whoever imported us specified a special allocation function */
48  {
49  /* Use it to allocate the memory */
51  if (Buffer)
52  {
53  /* Zero it out */
55  }
56  }
57  else
58  {
59  /* Use our default */
61  }
62 
63  /* Return the allocate pointer */
64  return Buffer;
65 }
66 
#define IN
Definition: typedefs.h:39
PDNS_FREE_FUNCTION pDnsFreeFunction
Definition: memory.c:19
VOID(WINAPI * PDNS_FREE_FUNCTION)(IN PVOID Buffer)
Definition: memory.c:16
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define LMEM_ZEROINIT
Definition: winbase.h:356
PVOID(WINAPI * PDNS_ALLOC_FUNCTION)(IN SIZE_T Size)
Definition: memory.c:14
#define WINAPI
Definition: msvc.h:6
PDNS_ALLOC_FUNCTION pDnsAllocFunction
Definition: memory.c:18
#define VOID
Definition: acefi.h:82
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID WINAPI Dns_Free(IN PVOID Address)
Definition: memory.c:25
ULONG_PTR SIZE_T
Definition: typedefs.h:79
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PVOID WINAPI Dns_AllocZero(IN SIZE_T Size)
Definition: memory.c:42
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34