From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4655121D046AB for ; Mon, 18 Sep 2017 22:20:31 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 18 Sep 2017 22:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,416,1500966000"; d="scan'208";a="1173592158" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 18 Sep 2017 22:23:35 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 22:23:34 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 22:23:34 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.175]) with mapi id 14.03.0319.002; Tue, 19 Sep 2017 13:23:32 +0800 From: "Wu, Jiaxin" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" Thread-Topic: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen Thread-Index: AQHTMOywnH2THfc2dE6Yf5GYb5AGE6K7rBLA Date: Tue, 19 Sep 2017 05:23:31 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B727416335388@SHSMSX103.ccr.corp.intel.com> References: <20170919021157.15996-1-hao.a.wu@intel.com> In-Reply-To: <20170919021157.15996-1-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTFiMDdhNzctOWQzOS00MTFhLTk0NTItNDBkNzJjNTQ1MzM4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImdVM21TaVExdXcyaGVmRndBaXBDRUxhcWk2cWZnVG5jMmZUSjB2QUNpbnM9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2017 05:20:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: Wu, Hao A > Sent: Tuesday, September 19, 2017 10:12 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Fu, Siyuan ; > Wu, Jiaxin > Subject: [PATCH] NetworkPkg/IScsiDxe: Remove redundant call to StrLen >=20 > The commits ultilizes a local variable to store the length of a string > which will be used right after. >=20 > Cc: Fu Siyuan > Cc: Wu Jiaxin > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > NetworkPkg/IScsiDxe/IScsiConfig.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > 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 ( >=20 > *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) =3D = L'/'; > } > - if (StrLen (IfrNvData->ISCSIMacAddr) !=3D 0) { > - *(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr) - 1) = =3D > L'\0'; > + > + StringLen =3D StrLen (IfrNvData->ISCSIMacAddr); > + if (StringLen > 0) { > + *(IfrNvData->ISCSIMacAddr + StringLen - 1) =3D L'\0'; > } > } > } > -- > 2.12.0.windows.1