MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / EfiReallocatePool

Function EfiReallocatePool

rEFIt_UEFI/libeg/BmLib.cpp:276–299  ·  view source on GitHub ↗

Adjusts the size of a previously allocated buffer. @param OldPool - A pointer to the buffer whose size is being adjusted. @param OldSize - The size of the current buffer. @param NewSize - The size of the new buffer. @return The newly allocated buffer. @retval NULL Allocation failed. **/

Source from the content-addressed store, hash-verified

274
275**/
276VOID *
277EfiReallocatePool (
278 IN VOID *OldPool,
279 IN UINTN OldSize,
280 IN UINTN NewSize
281 )
282{
283 VOID *NewPool;
284
285 NewPool = NULL;
286 if (NewSize != 0) {
287 NewPool = (__typeof__(NewPool))AllocateZeroPool(NewSize);
288 }
289
290 if (OldPool != NULL) {
291 if (NewPool != NULL) {
292 CopyMem(NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
293 }
294
295 FreePool(OldPool);
296 }
297
298 return NewPool;
299}
300
301/**
302 Compare two EFI_TIME data.

Callers 1

DirNextEntryFunction · 0.50

Calls 3

AllocateZeroPoolFunction · 0.50
CopyMemFunction · 0.50
FreePoolFunction · 0.50

Tested by

no test coverage detected