From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82498428BA; Tue, 4 Apr 2023 10:51:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15AC8410FA; Tue, 4 Apr 2023 10:51:16 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2CF2940EE3 for ; Tue, 4 Apr 2023 10:51:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680598274; x=1712134274; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=be5+0bIw448irTyGnU0o6OAtLNvMOnGXy6bw1i8knMU=; b=UpsLWYOWC7QWFM4Gwf+RPj+eFlf4J++6Bkv/uSNrr+fpTH5JCuVyxv+e n1S22usYA9w73YNZ/ScouCCXNcukYzDEkeW6zyWsMaC4xjuOzz0KeLAsX 0BObSBafWFxkWTutfRGmxsIXjdTQQGg9jb4+O8Tr+MlAI5wl71BL51Rbj U+dQy8ebvuXbaDJRywpyRUw1g5GxOzYi3RccEJ7z3dij313IzNiK21Pa3 b/pIDMdC3DKAeSl3GKJm/4hW89o1VwTaxissu9hI9X30qC9DbFhgNA4uq t8h9nqVkC+FARYdMLCEd9VOFiZj2ZFHO/gTPFSxHQoxQLg81L68Vm5tu8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="326146711" X-IronPort-AV: E=Sophos;i="5.98,317,1673942400"; d="scan'208";a="326146711" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2023 01:51:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10669"; a="775561748" X-IronPort-AV: E=Sophos;i="5.98,317,1673942400"; d="scan'208";a="775561748" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by FMSMGA003.fm.intel.com with ESMTP; 04 Apr 2023 01:51:12 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 4 Apr 2023 01:51:12 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Tue, 4 Apr 2023 01:51:12 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Tue, 4 Apr 2023 01:51:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kCi1cpIyWNzAowByeZDkJJ2XLDmakwgjG2QuIYuWZwyHyhCKOddpRR/FndRDVmASJdpdZz5TPvoWI48aRtWjFvuxYs9/+6HPEgxbD2LNLqxE6TPpDpByrqjktm9wZJoJxhhOyjluasILwLN+GkrDoVbjCnAb+pGK4KR3qo+/QWYe4sksTPpp4tZn2pJsGnVpDLsqzdnKnSR6CJTfib6wQTN78PynoVV+wqRglUVzdFtEHA9Udj/4g4OwyTc8G1SDLFlXCFb494cvYUGgf8feRg89DhAM0BpzylbGKYApUnHrwtQbrPRUhAjX8mXN2FtfFJaMCbB34QpcpFJDeS3X4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SPb9oNRWEY72KSX7VzmH+8yYsZhD1acWl8lHG1l/LF0=; b=jeIfWzTX7QAnldISXpwplUuoAHqK3JNRA13MW3aSQ8G4+3lYKVIZMiRCfepqkaYKjKb/d4RGH0yiMn2wQG/rkfICSRkYkE8W01/uZXGHBS8KZCbyJkcKAZ6IaJ5FGvyJMpudmFsEE/qSAeLEdAh8TMLCRbCu8CNDIjBMa89tAoLEKm3ge5N3h4bXzgy9ld83xBJeBNzgmWEECHMuEfOxW57pyeDb3ANzOALaZJ/0TD8W2hFt2LzjzJgtkgPbBSFmEIHRscIDeU0c7+SzLH4x3ZC4mP4XGLndgtFJh+owcrCR369uyTrkQmHLYXSJ7z30QmrEuISos6bKJ4UbGXqwbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SN7PR11MB6704.namprd11.prod.outlook.com (2603:10b6:806:267::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.28; Tue, 4 Apr 2023 08:51:10 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c%6]) with mapi id 15.20.6254.035; Tue, 4 Apr 2023 08:51:10 +0000 Date: Tue, 4 Apr 2023 09:51:04 +0100 From: Bruce Richardson To: Tyler Retzlaff CC: , , , Subject: Re: [PATCH v3] telemetry: use portable syntax to initialize array Message-ID: References: <1680539424-20255-1-git-send-email-roretzla@linux.microsoft.com> <1680548365-16525-1-git-send-email-roretzla@linux.microsoft.com> <1680548365-16525-2-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1680548365-16525-2-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: LO4P265CA0252.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:350::18) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SN7PR11MB6704:EE_ X-MS-Office365-Filtering-Correlation-Id: 49653fa3-c970-426f-62f7-08db34e9bc7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aNZxlmyD78cuNP77p6vvDm3wrBncwfk0D6KvJTZJk9bph3xEjtwQjwQhsp0GpTggx9ViHW5J+rgOuFjdhwjyarEiAp0HOG4ncfJf05Acz43Y5AB/XhSSyNpE70ZgEviEVlZAwKApftxAqTfRlfMcIKN4roHsNueqS+qPPW1VfiTIglIXtWZDH6cGcHXMus6NR8vAl6gvxJPCCvPYm0fdF6W+pK+F39GXkaiefUfdTqvzbRaJd6b2UV5rTk5DwdTOfRS6cRYb7S/swmDB27PtCkjDultV1nJ1oEH9TDTp63RmfodvNUjNsLVfVel9Rureiip/4zW18PoyrOR0QkiMqZJgsH24NHHgM36PuLtrUzGbXiEAUNthYjRhHu94pNwL+xchHFvJXPjns0dbsi1JqCE/pdWnyu9wRAi+fQnVeweLiN22ibqZ/DSmTm2KdRDCvAnf2nuk54gYFpXFpY5Pykz6Qo+4X5NuMhMe2SddGuqZAsK3g0ia9fLRYYYswVlC+txbcjGqNvPAU7mPAmFs2xnbfxdZaDRKj5iyx6KVrJg4ncQI+ZltLXfpj4y9yEzj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(376002)(396003)(136003)(346002)(366004)(451199021)(316002)(6666004)(6916009)(66476007)(8676002)(6486002)(4326008)(66556008)(66946007)(8936002)(5660300002)(41300700001)(2906002)(44832011)(478600001)(82960400001)(86362001)(186003)(38100700002)(6512007)(26005)(83380400001)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?mcaDlhvrMir+nk+SlUr7KUlB5CtNWnQna9om/sHZONTJKiaMXuAfSOz7bYOm?= =?us-ascii?Q?IgLivqN5A/AiFTWI4kzaFYOKcPfCJSFVypcJo3WU6INFIqLvOcLDuu/LOFUO?= =?us-ascii?Q?RKIG6ejHMBPhqosQNaPYHkf8fl+G1G3H37zc8dsmwTMYf6AA9kOUjdjHFsP3?= =?us-ascii?Q?r/o5vGbHXJu5zkJNxmhpjQN9OA+KF19jgusY7am0NwETyah/AXiGul77kD1O?= =?us-ascii?Q?GGp79Eq0gP9MTQdtqVD7iRjFl0h0PsoYlh4qau3EXfVXOOqo/NsOZ0+mBfF6?= =?us-ascii?Q?4PFUeozgsX7VMY3qLW8bcuNY932ax8JsLc8HnTduLK3v3nBt7mo0tz6r/fJE?= =?us-ascii?Q?j0QlZZnUgepC7P9hAUTen0Qk+8E7BdfPUyyn4AccAfADdpiWpIpXyfHVoy7j?= =?us-ascii?Q?i1HAiRdpGMJ4BE472OZrb880hdtZ2bO3JkqqTT0NSSbPkOUxaIlRL6XHN4FT?= =?us-ascii?Q?2QGdIJWf9GjZ2OD0qEgq668iyt6pPv1TW7czV4txvMiqSrEbAIyx74PsvWi5?= =?us-ascii?Q?rUqunt8P7Ayo3J7U2cK337mwJ9wS0/CfT2AHIFPB0UV3oQYudm1gAU1q3XKG?= =?us-ascii?Q?xYShjeI+JvxIySVp/ALnA0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xLZLr2agrMF6zSNqdWNL8moiw29j2XMdcjvbup09+X3E5Xl+F/WZB+JX?= =?us-ascii?Q?jt8PXXihGoLWjOY+V7mgBvFYAJpMXhUedYJ6lBZOjlSqfqBrJh3UvgPK/GSp?= =?us-ascii?Q?nA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 49653fa3-c970-426f-62f7-08db34e9bc7e X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 08:51:10.0503 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HfpbtlS1Xc4nRDG7s9Z4I8tkRpesynesQe/yKlDvnaU/q+TcoGt3Oa/waoZEDIlTJ302VkdW0UKRx8DrAg69ZFSR5WkxM85VJdZcnIJ4aGk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6704 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Apr 03, 2023 at 11:59:25AM -0700, Tyler Retzlaff wrote: > Use of ranges in designated initialization are a non-standard gcc > extension. Use loops to initialize permitted characters on first use. > > Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson > --- > lib/telemetry/telemetry_data.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) > > diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c > index 2bac2de..562b387 100644 > --- a/lib/telemetry/telemetry_data.c > +++ b/lib/telemetry/telemetry_data.c > @@ -152,13 +152,21 @@ > static bool > valid_name(const char *name) > { > - char allowed[128] = { > - ['0' ... '9'] = 1, > - ['A' ... 'Z'] = 1, > - ['a' ... 'z'] = 1, > - ['_'] = 1, > - ['/'] = 1, > - }; > + int index; My preference would be to limit the scope of index to the if block, but ok to keep as here. [In fact, when we switch to C11, I'd love to see the coding standards relaxed to allow loop variable definition inside the for statement itself] > + static bool initialized; > + static char allowed[128]; > + > + if (!initialized) { > + for (index = '0'; index <= '9'; index++) > + allowed[index] = 1; > + for (index = 'A'; index <= 'Z'; index++) > + allowed[index] = 1; > + for (index = 'a'; index <= 'z'; index++) > + allowed[index] = 1; > + allowed[(int)'_'] = allowed[(int)'/'] = 1; > + initialized = true; > + } > + > while (*name != '\0') { > if ((size_t)*name >= RTE_DIM(allowed) || allowed[(int)*name] == 0) > return false; > -- > 1.8.3.1 >