MCPcopy Create free account
hub / github.com/cisco/openh264 / InternalReallocate

Function InternalReallocate

codec/processing/src/common/memory.cpp:70–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68/////////////////////////////////////////////////////////////////////////////
69
70void* InternalReallocate (void* pPointer, const uint32_t kuiSize, char* pTag) {
71 uint32_t iOldSize = 0;
72 uint8_t* pNew = NULL;
73 if (pPointer != NULL)
74 iOldSize = * ((int32_t*) ((uint8_t*) pPointer - sizeof (void**) - sizeof (int32_t)));
75 else
76 return WelsMalloc (kuiSize, pTag);
77
78 pNew = (uint8_t*)WelsMalloc (kuiSize, pTag);
79 if (0 == pNew) {
80 if (iOldSize > 0 && kuiSize > 0 && iOldSize >= kuiSize)
81 return (pPointer);
82 return 0;
83 } else if (iOldSize > 0 && kuiSize > 0)
84 memcpy (pNew, pPointer, (iOldSize < kuiSize) ? iOldSize : kuiSize);
85 else
86 return 0;
87
88 WelsFree (pPointer, pTag);
89 return (pNew);
90}
91
92/////////////////////////////////////////////////////////////////////////////
93

Callers 1

WelsReallocFunction · 0.85

Calls 2

WelsMallocFunction · 0.70
WelsFreeFunction · 0.70

Tested by

no test coverage detected