summaryrefslogtreecommitdiff
path: root/NetworkPkg
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2017-09-19 09:45:50 +0800
committerHao Wu <hao.a.wu@intel.com>2017-09-20 16:04:17 +0800
commitb68c793144e8f239cf59fcc34ee6e35c1fdcd8a6 (patch)
treea8009a46a31558fff131048120595512023716b5 /NetworkPkg
parent70dc3ec5a72e0e3fc3ea8f63baecdeafd1110db8 (diff)
downloadedk2-b68c793144e8f239cf59fcc34ee6e35c1fdcd8a6.zip
edk2-b68c793144e8f239cf59fcc34ee6e35c1fdcd8a6.tar.gz
edk2-b68c793144e8f239cf59fcc34ee6e35c1fdcd8a6.tar.bz2
NetworkPkg/IScsiDxe: Remove redundant call to StrLen
The commits utilizes a local variable to store the length of a string which will be used right after. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/IScsiDxe/IScsiConfig.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index c0dd305..52e51d6 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';
}
}
}