From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH] kvargs: make pointers in string arrays const Date: Fri, 13 Jan 2017 18:44:45 +0100 Message-ID: <20170113184445.7d719306@platinum> References: <1484237907-30717-1-git-send-email-bruce.richardson@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Bruce Richardson Return-path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id D37BD2E8A for ; Fri, 13 Jan 2017 18:44:49 +0100 (CET) Received: by mail-wm0-f54.google.com with SMTP id r144so81275971wme.1 for ; Fri, 13 Jan 2017 09:44:49 -0800 (PST) In-Reply-To: <1484237907-30717-1-git-send-email-bruce.richardson@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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