From 4a7518d31a0254e4065d308f091bd7bc16dc8dba Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Tue, 28 Jun 2016 13:52:11 +0200 Subject: ShellPkg: don't call functions with side effects in ASSERT_EFI_ERROR() When ASSERT_EFI_ERROR() is compiled out, dependent on build flags, only the status checking should be removed; the function calls should stay. Cc: Jaben Carsey Cc: Shumin Qiu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Giri P Mudusuru Reviewed-by: Jaben Carsey --- ShellPkg/Library/UefiShellLevel1CommandsLib/If.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib') diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c index 7abfd8944b..dc96bffde7 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c @@ -991,8 +991,11 @@ ShellCommandRunElse ( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_STATUS Status; SCRIPT_FILE *CurrentScriptFile; - ASSERT_EFI_ERROR(CommandInit()); + + Status = CommandInit (); + ASSERT_EFI_ERROR (Status); if (gEfiShellParametersProtocol->Argc > 1) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); @@ -1066,8 +1069,11 @@ ShellCommandRunEndIf ( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_STATUS Status; SCRIPT_FILE *CurrentScriptFile; - ASSERT_EFI_ERROR(CommandInit()); + + Status = CommandInit (); + ASSERT_EFI_ERROR (Status); if (gEfiShellParametersProtocol->Argc > 1) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel1HiiHandle, L"if"); -- cgit v1.2.3