From f34a945a8024b8cb548168cae3a4a81600620ebb Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Wed, 24 Jul 2024 13:52:35 +0200 Subject: ShellPkg/UefiShellLib: Simplify check for empty string StrSize() uses StrLen() which counts until the terminating NULL character. For checking for an empty string it is more efficient to directly check for the NULL terminator instead of calling StrSize(). Signed-off-by: Tormod Volden --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index d053b6bb69..a512c2c251 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -4012,7 +4012,7 @@ InternalShellStrHexToUint64 ( UINT64 Result; BOOLEAN LeadingZero; - if ((String == NULL) || (StrSize (String) == sizeof (*String)) || (Value == NULL)) { + if ((String == NULL) || (*String == CHAR_NULL) || (Value == NULL)) { return (EFI_INVALID_PARAMETER); } @@ -4116,7 +4116,7 @@ InternalShellStrDecimalToUint64 ( { UINT64 Result; - if ((String == NULL) || (StrSize (String) == sizeof (*String)) || (Value == NULL)) { + if ((String == NULL) || (*String == CHAR_NULL) || (Value == NULL)) { return (EFI_INVALID_PARAMETER); } -- cgit