FireBirdLib - Topfield TMS PVR TAP Programming Library
TAP_MemRealloc.c
Go to the documentation of this file.
1#include "libFireBird.h"
2
3void *TAP_MemRealloc(void *ptr, size_t OldSize, size_t NewSize, bool InitMemory)
4{
6
7 void *temp;
8
9 temp = TAP_MemAlloc(NewSize);
10 if(temp == NULL)
11 {
12 // out of memory!
13 LogEntryFBLibPrintf(TRUE, "TAP_MemRealloc: not enough memory (alloc returned NULL)");
14
15 TRACEEXIT();
16 return NULL;
17 }
18
19 if(ptr && (OldSize > 0))
20 {
21 memcpy(temp, ptr, OldSize);
22 TAP_MemFree(ptr);
23 }
24
25 if(InitMemory) memset((byte *) temp + OldSize, 0, NewSize - OldSize);
26
27 TRACEEXIT();
28 return temp;
29}
void LogEntryFBLibPrintf(bool Console, char *format,...)
void * TAP_MemRealloc(void *ptr, size_t OldSize, size_t NewSize, bool InitMemory)
Definition: TAP_MemRealloc.c:3
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243