]> git.proxmox.com Git - mirror_edk2.git/commitdiff
move DeleteScriptFileStruct from a private to a public function. This allows for...
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 4 Oct 2010 16:26:29 +0000 (16:26 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 4 Oct 2010 16:26:29 +0000 (16:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10906 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Include/Library/ShellCommandLib.h
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h

index 53cc80b4b56749e18cadad5aba69ecccc1985c2e..af16c85ef36316fa0ee7cdba8217a941f17ef64a 100644 (file)
@@ -419,6 +419,17 @@ ShellCommandSetNewScript (
   IN SCRIPT_FILE *Script OPTIONAL\r
   );\r
 \r
+/**\r
+  Function to cleanup all memory from a SCRIPT_FILE structure.\r
+\r
+  @param[in] Script     The pointer to the structure to cleanup.\r
+**/\r
+VOID\r
+EFIAPI\r
+DeleteScriptFileStruct (\r
+  IN SCRIPT_FILE *Script\r
+  );\r
+\r
 /**\r
   Function to get the current Profile string.\r
 \r
index 5a3739ff91f366b97b7f0fe3339ce909f0d79d0d..4aec5d44ca0583b261cf606bfeca8bdbe6bd407f 100644 (file)
@@ -767,13 +767,16 @@ DeleteScriptFileStruct (
   )\r
 {\r
   UINT8       LoopVar;\r
-  ASSERT(Script             != NULL);\r
-  ASSERT(Script->ScriptName != NULL);\r
+\r
+  if (Script == NULL) {\r
+    return;\r
+  }\r
+\r
   for (LoopVar = 0 ; LoopVar < Script->Argc ; LoopVar++) {\r
-    FreePool(Script->Argv[LoopVar]);\r
+    SHELL_FREE_NON_NULL(Script->Argv[LoopVar]);\r
   }\r
   if (Script->Argv != NULL) {\r
-    FreePool(Script->Argv);\r
+    SHELL_FREE_NON_NULL(Script->Argv);\r
   }\r
   Script->CurrentCommand = NULL;\r
   while (!IsListEmpty (&Script->CommandList)) {\r
@@ -781,16 +784,16 @@ DeleteScriptFileStruct (
     if (Script->CurrentCommand != NULL) {\r
       RemoveEntryList(&Script->CurrentCommand->Link);\r
       if (Script->CurrentCommand->Cl != NULL) {\r
-        FreePool(Script->CurrentCommand->Cl);\r
+        SHELL_FREE_NON_NULL(Script->CurrentCommand->Cl);\r
       }\r
       if (Script->CurrentCommand->Data != NULL) {\r
-        FreePool(Script->CurrentCommand->Data);\r
+        SHELL_FREE_NON_NULL(Script->CurrentCommand->Data);\r
       }\r
-      FreePool(Script->CurrentCommand);\r
+      SHELL_FREE_NON_NULL(Script->CurrentCommand);\r
     }\r
   }\r
-  FreePool(Script->ScriptName);\r
-  FreePool(Script);\r
+  SHELL_FREE_NON_NULL(Script->ScriptName);\r
+  SHELL_FREE_NON_NULL(Script);\r
 }\r
 \r
 /**\r
@@ -833,7 +836,6 @@ ShellCommandSetNewScript (
   SCRIPT_FILE_LIST *Node;\r
   if (Script == NULL) {\r
     if (IsListEmpty (&mScriptList.Link)) {\r
-      ASSERT(FALSE);\r
       return (NULL);\r
     }\r
     Node = (SCRIPT_FILE_LIST *)GetFirstNode(&mScriptList.Link);\r
@@ -842,6 +844,9 @@ ShellCommandSetNewScript (
     FreePool(Node);\r
   } else {\r
     Node = AllocateZeroPool(sizeof(SCRIPT_FILE_LIST));\r
+    if (Node == NULL) {\r
+      return (NULL);\r
+    }\r
     Node->Data = Script;\r
     InsertHeadList(&mScriptList.Link, &Node->Link);\r
   }\r
@@ -1025,7 +1030,7 @@ ShellCommandCreateInitialMappingsAndPaths(
   //\r
   // Find each handle with Simple File System\r
   //\r
-  HandleList = GetHandleListByPotocol(&gEfiSimpleFileSystemProtocolGuid);\r
+  HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid);\r
   if (HandleList != NULL) {\r
     //\r
     // Do a count of the handles\r
@@ -1085,7 +1090,7 @@ ShellCommandCreateInitialMappingsAndPaths(
   //\r
   // Find each handle with Block Io\r
   //\r
-  HandleList = GetHandleListByPotocol(&gEfiBlockIoProtocolGuid);\r
+  HandleList = GetHandleListByProtocol(&gEfiBlockIoProtocolGuid);\r
   if (HandleList != NULL) {\r
     for (Count = 0 ; HandleList[Count] != NULL ; Count++);\r
 \r
index 6327ae54c5fbe5da4ac45cac37e6bb6a84816eff..ef81dd3f894c95f596ebe4aef639fb78d1b8b932 100644 (file)
@@ -58,17 +58,6 @@ typedef struct {
   SCRIPT_FILE *Data;\r
 } SCRIPT_FILE_LIST;\r
 \r
-/**\r
-  Function to cleanup all memory from a SCRIPT_FILE structure.\r
-\r
-  @param[in] Script     The pointer to the structure to cleanup.\r
-**/\r
-VOID\r
-EFIAPI\r
-DeleteScriptFileStruct (\r
-  IN SCRIPT_FILE *Script\r
-  );\r
-\r
 typedef struct {\r
   EFI_FILE_PROTOCOL *FileHandle;\r
   CHAR16            *Path;\r