From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 A5F8221CEB104 for ; Mon, 18 Sep 2017 19:08:57 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2017 19:12:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,415,1500966000"; d="scan'208";a="136839463" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.13]) by orsmga002.jf.intel.com with ESMTP; 18 Sep 2017 19:11:58 -0700 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Fu Siyuan , Wu Jiaxin Date: Tue, 19 Sep 2017 10:11:57 +0800 Message-Id: <20170919021157.15996-1-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 Subject: [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 02:08:57 -0000 The commits ultilizes a local variable to store the length of a string which will be used right after. 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(-) 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