From: "Fu, Siyuan" <siyuan.fu@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Wu, Jiaxin" <jiaxin.wu@intel.com>
Subject: Re: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen
Date: Tue, 19 Sep 2017 04:18:03 +0000 [thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58B3B6DD7@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170919021157.15996-1-hao.a.wu@intel.com>
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
next prev parent reply other threads:[~2017-09-19 4:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 2:11 [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen Hao Wu
2017-09-19 4:18 ` Fu, Siyuan [this message]
2017-09-19 5:23 ` Wu, Jiaxin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B1FF2E9001CE9041BD10B825821D5BC58B3B6DD7@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox