From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 D9C6281F79 for ; Thu, 8 Dec 2016 15:47:09 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 08 Dec 2016 15:47:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,321,1477983600"; d="scan'208";a="1079461598" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 08 Dec 2016 15:47:09 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 8 Dec 2016 15:47:09 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 8 Dec 2016 15:47:09 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.11]) by shsmsx102.ccr.corp.intel.com ([169.254.2.37]) with mapi id 14.03.0248.002; Fri, 9 Dec 2016 07:47:05 +0800 From: "Yao, Jiewen" To: Kurt Kennett , "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Thread-Index: AQHSUUGEv7dYXu5p+0mZLsjiSWUaf6D+TfQwgABqC0A= Date: Thu, 8 Dec 2016 23:47:04 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386F23F1@SHSMSX104.ccr.corp.intel.com> References: <1481194467-75920-1-git-send-email-dandan.bi@intel.com> <1481194467-75920-3-git-send-email-dandan.bi@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2016 23:47:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Agree. Maybe we can move it to be a global variable ? Thank you Yao Jiewen > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ku= rt > Kennett > Sent: Friday, December 9, 2016 1:28 AM > To: Bi, Dandan ; edk2-devel@lists.01.org > Cc: Ni, Ruiyu > Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variabl= e after > declaration >=20 > This seems kind of silly. > Why isn't this just const data? This adds code and memory accesses that = are > worthless and happen on every call to the function. >=20 > K2 >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Dandan Bi > Sent: Thursday, December 8, 2016 2:54 AM > To: edk2-devel@lists.01.org > Cc: Ruiyu Ni > Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable af= ter > declaration >=20 > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi > --- > FatPkg/EnhancedFatDxe/Misc.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c > index f91759c..6ad688c 100644 > --- a/FatPkg/EnhancedFatDxe/Misc.c > +++ b/FatPkg/EnhancedFatDxe/Misc.c > @@ -696,15 +696,27 @@ Returns: > TRUE - The time is valid. > FALSE - The time is not valid. >=20 > --*/ > { > - static UINT8 MonthDays[] =3D { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31= , 30, 31 }; > + STATIC UINT8 MonthDays[12]; > UINTN Day; > BOOLEAN ValidTime; >=20 > ValidTime =3D TRUE; > + MonthDays[0] =3D 31; > + MonthDays[1] =3D 28; > + MonthDays[2] =3D 31; > + MonthDays[3] =3D 30; > + MonthDays[4] =3D 31; > + MonthDays[5] =3D 30; > + MonthDays[6] =3D 31; > + MonthDays[7] =3D 31; > + MonthDays[8] =3D 30; > + MonthDays[9] =3D 31; > + MonthDays[10] =3D 30; > + MonthDays[11] =3D 31; >=20 > // > // Check the fields for range problems > // Fat can only support from 1980 > // > -- > 1.9.5.msysgit.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel