Reviewed-by: Fu Siyuan <[email protected]> -----Original Message----- From: Wu, Hao A Sent: Tuesday, September 19, 2017 10:12 AM To: [email protected] Cc: Wu, Hao A <[email protected]>; Fu, Siyuan <[email protected]>; Wu, Jiaxin <[email protected]> Subject: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen
The commits ultilizes a local variable to store the length of a string which will be used right after. Cc: Fu Siyuan <[email protected]> Cc: Wu Jiaxin <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <[email protected]> --- NetworkPkg/IScsiDxe/IScsiConfig.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c index c0dd305ecf..52e51d6b31 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfig.c +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c @@ -766,8 +766,10 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword ( *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) = L'/'; } - if (StrLen (IfrNvData->ISCSIMacAddr) != 0) { - *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr) - 1) = L'\0'; + + StringLen = StrLen (IfrNvData->ISCSIMacAddr); + if (StringLen > 0) { + *(IfrNvData->ISCSIMacAddr + StringLen - 1) = L'\0'; } } } -- 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

