[dpdk-dev] [PATCH] kvargs: make pointers in string arrays const

Thomas Monjalon thomas.monjalon at 6wind.com
Fri Jan 13 19:29:09 CET 2017


2017-01-13 18:44, Olivier Matz:
> On Thu, 12 Jan 2017 16:18:27 +0000, Bruce Richardson
> <bruce.richardson at intel.com> 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 <bruce.richardson at intel.com>
> 
> Acked-by: Olivier Matz <olivier.matz at 6wind.com>

Applied, thanks


More information about the dev mailing list