From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on072b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe48::72b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DDD1681D66 for ; Thu, 8 Dec 2016 09:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=v862+Fasv/xWVww7/RcCrXODbQQ7h3wQZ5oPETApvdg=; b=Tiura+dXGaW2rslQwmOJwre1wokFMQA8R+Li3rWoL/5yKOTtoS33S6DL9v4YLtp5pqZPTw+LAUfGqAu9Jc0LVzAiudctb6SYsNZ2E93JXeTHnYVeyDnkqHBREsgSaFYVIp5uyKWgst3OsrExqNQoizLO6A9/aQHLtFGaBuWnndI= Received: from CY1PR03MB2345.namprd03.prod.outlook.com (10.166.207.144) by CY1PR03MB2345.namprd03.prod.outlook.com (10.166.207.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Thu, 8 Dec 2016 17:27:34 +0000 Received: from CY1PR03MB2345.namprd03.prod.outlook.com ([10.166.207.144]) by CY1PR03MB2345.namprd03.prod.outlook.com ([10.166.207.144]) with mapi id 15.01.0761.018; Thu, 8 Dec 2016 17:27:34 +0000 From: Kurt Kennett To: Dandan Bi , "edk2-devel@lists.01.org" CC: Ruiyu Ni Thread-Topic: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Thread-Index: AQHSUUGEv7dYXu5p+0mZLsjiSWUaf6D+TfQw Date: Thu, 8 Dec 2016 17:27:34 +0000 Message-ID: References: <1481194467-75920-1-git-send-email-dandan.bi@intel.com> <1481194467-75920-3-git-send-email-dandan.bi@intel.com> In-Reply-To: <1481194467-75920-3-git-send-email-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Kurt.Kennett@microsoft.com; x-originating-ip: [2001:4898:80e8::d5] x-ms-office365-filtering-correlation-id: 55bd6039-d3b9-407e-08fd-08d41f8f7fa3 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR03MB2345; x-microsoft-exchange-diagnostics: 1; CY1PR03MB2345; 7:vM5v17HAYPn39MsgQ1mo4OFj+bL2NtBpQ0QuDqmwiCxhLADfTH/zDDltGn7jtR9HvzDxSYFdMeqtniQGeTA4tXhbczzX97mcNaNv3QZfIt8J9p5Mo3yM4tOm/HMxGVBq8Ma+rM+yUtV43bySTdagTALMt0mj+OLVCYGvWrjjBJ17N1Ee1elpqqSljl/WSuLE6gC72DgYNsJP5cVMLFZ8vUmqVVeRQRmXhCFvpzq8TOi6iuRqFjgaaZmCt99SQsHQvHcRz8aGW9SGy4O9+vm+Y9UuhKollhHGsSWCey6baxiKfksUB2Cis8ZmUV+WxVQLAqwx9m3UafjVoGE8YfPOYPzRhwOc8xdrdmWkFeLvjg4A+nQp5JmYcC0rVRhUz9fcEe/QROOEFmIXy0+l1y2TpL3RMTG9yqM9s7FmG5BlakmOPvJsyLLUUiPBmAqBQM5wCRXkr6NwjZiqISpAPiIMLltuPO0bkP7NXLd+uSyL7eQ= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6047074)(6072148); SRVR:CY1PR03MB2345; BCL:0; PCL:0; RULEID:; SRVR:CY1PR03MB2345; x-forefront-prvs: 0150F3F97D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39860400002)(39450400003)(39410400002)(39840400002)(39850400002)(189002)(13464003)(199003)(377454003)(8676002)(5001770100001)(101416001)(86612001)(3280700002)(2501003)(7846002)(54356999)(50986999)(76176999)(9686002)(122556002)(68736007)(38730400001)(102836003)(3660700001)(305945005)(6116002)(81166006)(86362001)(81156014)(77096006)(97736004)(6506006)(99286002)(7696004)(76576001)(33656002)(229853002)(8990500004)(10290500002)(5005710100001)(2950100002)(5660300001)(106356001)(189998001)(74316002)(2900100001)(2906002)(7736002)(8936002)(4326007)(105586002)(106116001)(92566002)(10090500001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR03MB2345; H:CY1PR03MB2345.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2016 17:27:34.7177 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2345 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 17:27:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This seems kind of silly. Why isn't this just const data? This adds code and memory accesses that ar= e worthless and happen on every call to the function. K2 -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dand= an 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 afte= r declaration 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(-) diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c in= dex 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel