]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c
Merge PEI & DXE LzmaCustomDecompressLib. A previous implementation
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / LzmaCustomDecompressLib / LzmaDecompress.c
index f1729825c746a8534ca3579c7929b67994f043e8..439e15beaba74b594dc9167b6a62c7c53032beb6 100644 (file)
 #include "Sdk/C/7zVersion.h"\r
 #include "Sdk/C/LzmaDec.h"\r
 \r
-extern ISzAlloc g_Alloc;\r
+/**\r
+  Allocation routine used by LZMA decompression.\r
+\r
+  @param p                Pointer to the ISzAlloc instance\r
+  @param size             The size in bytes to be allocated\r
+\r
+  @return The allocated pointer address, or NULL on failure\r
+**/\r
+STATIC\r
+VOID *\r
+SzAlloc (\r
+  void *p,\r
+  size_t size\r
+  )\r
+{\r
+  return AllocatePool (size);\r
+}\r
+\r
+/**\r
+  Free routine used by LZMA decompression.\r
+\r
+  @param p                Pointer to the ISzAlloc instance\r
+  @param address          The address to be freed\r
+**/\r
+STATIC\r
+VOID\r
+SzFree (\r
+  void *p,\r
+  void *address\r
+  )\r
+{\r
+  if (address != NULL) {\r
+    FreePool (address);\r
+  }\r
+}\r
+\r
+STATIC ISzAlloc g_Alloc = { SzAlloc, SzFree };\r
 \r
 #define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)\r
 \r