From c46484952ad23fca742f8e6add49d78bda702d58 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Sat, 22 Nov 2008 00:52:53 +0000 Subject: Update to use ReallocatePool() from BaseMemoryLib git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6678 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/DevicePathDxe/DevicePathToText.c | 43 ++-------------------- 1 file changed, 4 insertions(+), 39 deletions(-) (limited to 'MdeModulePkg/Universal/DevicePathDxe') diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c index a9f6afcf4a..5de21b1f9d 100644 --- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c +++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c @@ -14,41 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "DevicePath.h" -/** - 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 A pointer to the new buffer or NULL if allocation fails. - -**/ -VOID * -ReallocatePool ( - IN VOID *OldPool, - IN UINTN OldSize, - IN UINTN NewSize - ) -{ - VOID *NewPool; - - NewPool = NULL; - if (NewSize != 0) { - NewPool = AllocateZeroPool (NewSize); - } - - if (OldPool != NULL) { - if (NewPool != NULL) { - CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); - } - - FreePool (OldPool); - } - - return NewPool; -} - /** Concatenates a formatted unicode string to allocated pool. The caller must free the resulting buffer. @@ -90,9 +55,9 @@ CatPrint ( Size = StrSize (AppendStr) - sizeof (UINT16); Size = Size + StrSize (Str->Str); Str->Str = ReallocatePool ( - Str->Str, StrSize (Str->Str), - Size + Size, + Str->Str ); ASSERT (Str->Str != NULL); } @@ -1752,7 +1717,7 @@ ConvertDeviceNodeToText ( // Shrink pool used for string allocation // NewSize = (Str.Len + 1) * sizeof (CHAR16); - Str.Str = ReallocatePool (Str.Str, NewSize, NewSize); + Str.Str = ReallocatePool (NewSize, NewSize, Str.Str); ASSERT (Str.Str != NULL); Str.Str[Str.Len] = 0; return Str.Str; @@ -1841,7 +1806,7 @@ ConvertDevicePathToText ( } NewSize = (Str.Len + 1) * sizeof (CHAR16); - Str.Str = ReallocatePool (Str.Str, NewSize, NewSize); + Str.Str = ReallocatePool (NewSize, NewSize, Str.Str); ASSERT (Str.Str != NULL); Str.Str[Str.Len] = 0; return Str.Str; -- cgit v1.2.3