* [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen
@ 2017-09-19 2:11 Hao Wu
2017-09-19 4:18 ` Fu, Siyuan
2017-09-19 5:23 ` Wu, Jiaxin
0 siblings, 2 replies; 3+ messages in thread
From: Hao Wu @ 2017-09-19 2:11 UTC (permalink / raw)
To: edk2-devel; +Cc: Hao Wu, Fu Siyuan, Wu Jiaxin
The commits ultilizes a local variable to store the length of a string
which will be used right after.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen
2017-09-19 2:11 [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen Hao Wu
@ 2017-09-19 4:18 ` Fu, Siyuan
2017-09-19 5:23 ` Wu, Jiaxin
1 sibling, 0 replies; 3+ messages in thread
From: Fu, Siyuan @ 2017-09-19 4:18 UTC (permalink / raw)
To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Wu, Jiaxin
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
-----Original Message-----
From: Wu, Hao A
Sent: Tuesday, September 19, 2017 10:12 AM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
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 <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen
2017-09-19 2:11 [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen Hao Wu
2017-09-19 4:18 ` Fu, Siyuan
@ 2017-09-19 5:23 ` Wu, Jiaxin
1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jiaxin @ 2017-09-19 5:23 UTC (permalink / raw)
To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Fu, Siyuan
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
> -----Original Message-----
> From: Wu, Hao A
> Sent: Tuesday, September 19, 2017 10:12 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>;
> Wu, Jiaxin <jiaxin.wu@intel.com>
> 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 <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-19 5:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 2:11 [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen Hao Wu
2017-09-19 4:18 ` Fu, Siyuan
2017-09-19 5:23 ` Wu, Jiaxin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox