]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update to use ReallocatePool() from BaseMemoryLib
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 22 Nov 2008 00:52:31 +0000 (00:52 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 22 Nov 2008 00:52:31 +0000 (00:52 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6677 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/GenericBdsLib/DevicePath.c

index f420625fc920fa1518d5eeed8c14c753806863ac..421bba00cb37119e2961d6e50b2aab1fa1693f5b 100644 (file)
@@ -15,42 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "InternalBdsLib.h"\r
 \r
-/**\r
-\r
-  Adjusts the size of a previously allocated buffer.\r
-\r
-  @param OldPool         A pointer to the buffer whose size is being adjusted.\r
-  @param OldSize         The size of the current buffer.\r
-  @param NewSize         The size of the new buffer.\r
-\r
-  @return The new buffer allocated. If allocatio failed, NULL will be returned.\r
-\r
-**/\r
-VOID *\r
-ReallocatePool (\r
-  IN VOID                 *OldPool,\r
-  IN UINTN                OldSize,\r
-  IN UINTN                NewSize\r
-  )\r
-{\r
-  VOID  *NewPool;\r
-\r
-  NewPool = NULL;\r
-  if (NewSize != 0) {\r
-    NewPool = AllocateZeroPool (NewSize);\r
-  }\r
-\r
-  if (OldPool != NULL) {\r
-    if (NewPool != NULL) {\r
-      CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);\r
-    }\r
-\r
-    FreePool (OldPool);\r
-  }\r
-\r
-  return NewPool;\r
-}\r
-\r
 /**\r
   Concatenates a formatted unicode string to allocated pool.\r
   The caller must free the resulting buffer.\r
@@ -95,9 +59,9 @@ CatPrint (
     StringSize += (StrSize (Str->str) - sizeof (UINT16));\r
 \r
     Str->str = ReallocatePool (\r
-                Str->str,\r
                 StrSize (Str->str),\r
-                StringSize\r
+                StringSize,\r
+                Str->str\r
                 );\r
     ASSERT (Str->str != NULL);\r
   }\r
@@ -1523,7 +1487,7 @@ DevicePathToStr (
 \r
 Done:\r
   NewSize = (Str.len + 1) * sizeof (CHAR16);\r
-  Str.str = ReallocatePool (Str.str, NewSize, NewSize);\r
+  Str.str = ReallocatePool (NewSize, NewSize, Str.str);\r
   ASSERT (Str.str != NULL);\r
   Str.str[Str.len] = 0;\r
   return Str.str;\r