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 BACC7428AF; Wed, 5 Apr 2023 10:56:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD0C841153; Wed, 5 Apr 2023 10:56:41 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id D91E041151 for ; Wed, 5 Apr 2023 10:56:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680685000; x=1712221000; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=OZDzbyN8itB9pxoie6zIJOFeurFLn68lNRhxaZCxCEE=; b=M9fqm0W02p+FLc0jcjON+/FEkVkPgHAW9VUmvVetCALjZdKT0vt2fc/8 FPGatGN0cti79UdpB9TfHL7zmzkPVEYuiKuagwpkd5Jp+O/US+QPHFq72 B//jpBRz4MZVBq7/hRaWXahi/i6hsO+uUrVulmYgaBThwAiOIwuAmKiz0 qvsAXLQnrTwbpjQBSgASgCP+/nxL0EH2yFu/8/C4w5NHLRKeSGWthMSrm Nb0dgHMvlhd2WzL3+YVOERuwX3MgdTZ9ML5sBia5femzJfEhkCu9Rlwlg qVUVXRc9nUIqs/chdaU09D8psXJsLrxTHrXvps+vs6wNq6boy5ZsgH4m8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="344117669" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="344117669" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 01:56:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="1016402763" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="1016402763" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP; 05 Apr 2023 01:56:38 -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; Wed, 5 Apr 2023 01:56:38 -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; Wed, 5 Apr 2023 01:56:38 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) 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; Wed, 5 Apr 2023 01:56:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtDTBqwl6HYKd1ElIemV1KXylvV8PaORSSS9MiW2xLoqz7WgUCOPRbBr9GpJD6pQ1wzNYwzBPe4F1mTDTjnZ0i66zckb52MUBhPtRiwbMV69AvB/Lc01E7xPaaFMtmrgFoGsldQ+FlOsdM9vcx4aj0+t+mM57ipff6dIdCSctogFA0vdMJNjDwTUILgezTw5PmxThxgXP3xRC4ZgSc3u4F39BPK8kDqZaLl2X/YXPMbTMmnX6F96LdeRcQnjQ6R3z6C9HWAdnDz9qPZiLuTqWaqQYeSZKYOh6qHN05nRDfTP3aoMNzP4fhTzW69kbLIEsdEq6wSyMmIjehP5nyu93g== 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=zhsHENFGZ8YuGBIgHznpWkCPQZgQWfOYtTazr95mJt8=; b=Ti21Aak2Wp8vFlvO5RkB+achZN0zGOWtkk2wxUmTIH7dr13olb23Q0ET83B97U3E7/K4iqoMA9vXtZ2rS/ljFfelSUdSslth/tbF3pxZL8b3mF85zbn1zas1tBjofd78pu/05S2Vw6fPsQkX0uZix6pfvbT7xBCtn2pBHYHd48sz5FKBzOW1JFwLJA4woSFm4vmwu8EBiSvAWgUR52lUXEAR9yqpmBpCBeGt4FmJWZO5OAJoknlI6RjsrjDWP6z9QkLOpVVoq/teuVKRtzNi9jhsPDMKjOzSgVPzRZesqYlbznJA+idrvhHxVCZWKKWcK7ji4x/hUQK1CPNT2XDDGw== 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 CH0PR11MB5491.namprd11.prod.outlook.com (2603:10b6:610:d6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Wed, 5 Apr 2023 08:56:30 +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; Wed, 5 Apr 2023 08:56:30 +0000 Date: Wed, 5 Apr 2023 09:56:24 +0100 From: Bruce Richardson To: Tyler Retzlaff CC: , , , , Subject: Re: [PATCH v4] telemetry: remove non-portable array initialization syntax Message-ID: References: <1680539424-20255-1-git-send-email-roretzla@linux.microsoft.com> <1680631756-7222-1-git-send-email-roretzla@linux.microsoft.com> <1680631756-7222-2-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1680631756-7222-2-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: LO4P123CA0599.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:295::11) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CH0PR11MB5491:EE_ X-MS-Office365-Filtering-Correlation-Id: dfb08e87-034b-438b-37f7-08db35b3a60e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FNMMki2zQhqHy6fOizl2dxVe+Qg+mRqDSIwypGFmrM53r8NitJLDnE7SUK/iB6L8wLr85tCy2Qc+ZQOM6IJOhAFXmGoHhIL7asBgwoAw3JXjBF+EitC+4gw2WmoZcT635OeM4sOmuEUHuZQkV65CTNEJQkUwCPCcd4xTfupT3mwJ/MF4YGdk+reHopRh2xlyPyYu3y0W07E2u1slUuNaZ+losO10Hz6i/U7UIADqm3mYrfbkV+WfqGb6QSy/ma5d7N8vx1eOjb+EIJgAvC9GC0HHzyfJ9dbzKSRbWQrVGbfyxaUA83FhBjpF87ilUEZyq8xzv3COQsH+xh39w1MHfs1cSuVovEy0awIk5bDBfBSem2IiHhifk4GukdC66ojtLD8FvX9YuiDU6AbBJFwZIeMmQXisxJEJhAxOGI5373HtiZ8KBbgYyvmsvd4Z/cz6+nRzVvvqdZZaxRMbTJu3FcZCsSoGN0PVLBm2P7pAESNsdX9FVIB0gS+0UOmfvPRGdTQzdWi6XgcQ7OCUxXFrexTDtgsPepMFBKJF91sasoiJle+JaBw17hlRIYcGwVOv 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)(396003)(366004)(39860400002)(376002)(346002)(136003)(451199021)(6666004)(186003)(26005)(83380400001)(66946007)(8676002)(6512007)(478600001)(41300700001)(316002)(6506007)(6916009)(4326008)(82960400001)(66476007)(66556008)(6486002)(38100700002)(86362001)(5660300002)(2906002)(44832011)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kKd5RF/JJJotCccipnXY7zQwryBTVv1HT107RWBsZbxNXN5GD+3kmNUz2vs7?= =?us-ascii?Q?zf+CUetfRTal7DOXYbqqTHYat9bEw6rDxinIBF7ImDtyPHILcAFKxYxNw1+v?= =?us-ascii?Q?ZkB9l7P77ZE8wWoy0zsjlSlhj0ss2BhYCq2+Z0NM9Q0nrUpu4zV07efaJaeD?= =?us-ascii?Q?NNyjfOX0UXU1+iP3/VWfwwVjMnMi32EHqCHXlU8maBCcj463yHLMztl5pCUu?= =?us-ascii?Q?xyubLqkB3vPRR8ng70/jiUREChxdZID8LnD/E7z1FoUbSP4lqc+Oa/f0JP8F?= =?us-ascii?Q?WjuRos3utrA/FqDGabzOoV6e5lBuYRwZGs2LcjVkB5CuPfOhxMZgMSFEygMZ?= =?us-ascii?Q?F4ILZZ4WRPYG4L/OJpUYw06J3NLaBeoVgIoMhL0NN96X2lS5ItZTV+xAbeHo?= =?us-ascii?Q?9vQKiUUg4FRhGPYrfSnYvDT0OQvnf3+W5GKgqn3FFmLTJMIYf/nLldsb8kjb?= =?us-ascii?Q?LZqsWs+tfhcJypfz7WYKi73zhxHRBwFy0RCp4IHn6URSKPRbrqaXnGGZy0dw?= =?us-ascii?Q?vwqpR+vHwB0qFr7a52a2hkClXFyHGPgs8MW1Tb+YHK/qUYYGSp0rha4QDHpc?= =?us-ascii?Q?7ukj4vwpD0rGjcY7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us-ascii?Q?xIglU74dD2R0jm3sWg1tk7QYIJhp3pPpuStXrEM1yPQejD3RitFftVuyWqjQ?= =?us-ascii?Q?sEN9MO+vk9vHjTOEZJjWzKbABvmCcRIp7d0WCvZHvZW6H1lhrUtzPLbV//8O?= =?us-ascii?Q?Ew=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: dfb08e87-034b-438b-37f7-08db35b3a60e X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2023 08:56:30.7043 (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: pTRmZK/FlwHUdKEWtdtTnRFy3+Ld9itLu0PB5cdkcv2fy+jF0NTaN2s4UkZsPB54xgZcai/cTJdtX9ix/Lexh8V5Js00Et7wSZADnAtKg+8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR11MB5491 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 Tue, Apr 04, 2023 at 11:09:16AM -0700, Tyler Retzlaff wrote: > Use of ranges in designated initialization are a non-standard gcc > extension. > > Only initialize '_' and '/' elements of the array and filter tests > of characters through name with standard C isalnum before checking > the array. > > Suggested-by: Konstantin Ananyev > Suggested-by: Bruce Richardson > Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson The array should probably be "static", which was a miss in the original version too. > --- > lib/telemetry/telemetry_data.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c > index 2bac2de..0dc091a 100644 > --- a/lib/telemetry/telemetry_data.c > +++ b/lib/telemetry/telemetry_data.c > @@ -2,6 +2,7 @@ > * Copyright(c) 2020 Intel Corporation > */ > > +#include > #include > #include > #include > @@ -152,17 +153,14 @@ > static bool > valid_name(const char *name) > { > - char allowed[128] = { > - ['0' ... '9'] = 1, > - ['A' ... 'Z'] = 1, > - ['a' ... 'z'] = 1, > - ['_'] = 1, > - ['/'] = 1, > - }; > - while (*name != '\0') { > + /* non-alpha-numeric characters allowed in names */ > + const char allowed[128] = { ['_'] = 1, ['/'] = 1 }; > + > + for (; *name != '\0'; name++) { > + if (isalnum(*name)) > + continue; > if ((size_t)*name >= RTE_DIM(allowed) || allowed[(int)*name] == 0) > return false; > - name++; > } > return true; > } > -- > 1.8.3.1 >