From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] kvargs: make pointers in string arrays const Date: Fri, 13 Jan 2017 19:29:09 +0100 Message-ID: <4014355.qTqRYq3TGR@xps13> References: <1484237907-30717-1-git-send-email-bruce.richardson@intel.com> <20170113184445.7d719306@platinum> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Olivier Matz To: Bruce Richardson Return-path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 862412C6B for ; Fri, 13 Jan 2017 19:29:12 +0100 (CET) Received: by mail-wm0-f52.google.com with SMTP id c85so76413371wmi.1 for ; Fri, 13 Jan 2017 10:29:12 -0800 (PST) In-Reply-To: <20170113184445.7d719306@platinum> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2017-01-13 18:44, Olivier Matz: > On Thu, 12 Jan 2017 16:18:27 +0000, Bruce Richardson > wrote: > > Change the parameters of functions from const char *valid[] to > > const char * const valid[]. This additional const is needed to > > allow us to fix some checkpatch warnings, as well as being good > > programming practice. > > > > For the checkpatch warnings, if we have a set of command line > > args that we want to check defined as: > > static const char *args[] = { "arg1", "arg2", NULL }; > > kvlist = rte_kvargs_parse(params, args); > > > > checkpatch will complain: > > WARNING:STATIC_CONST_CHAR_ARRAY: static const char * > > array should probably be static const char * const > > > > Adding the additional const to the definition of the args > > will then trigger a compiler error in the absense of this > > change to the kvargs library, as we lose the const in the > > call to kvargs_parse. > > > > Signed-off-by: Bruce Richardson > > Acked-by: Olivier Matz Applied, thanks