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 <debian.tormod@gmail.com>
This commit is contained in:
Tormod Volden 2024-07-24 13:52:35 +02:00 committed by mergify[bot]
parent e11a912aa3
commit f34a945a80
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}