> -----Original Message-----
> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> Sent: Thursday, May 16, 2019 9:37 AM
> To: Ergin, Mesut A <mesut.a.er...@intel.com>
> Cc: olivier.m...@6wind.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] kvargs: trim spaces at the beginning and end
> of
> key and values
>
> On Wed, 15 May 2019 22:41:07 -0700
> Mesut Ali Ergin <mesut.a.er...@intel.com> wrote:
>
> > +/* trim leading and trailing spaces */
> > +static char *
> > +trim_space(char *str)
> > +{
> > + char *start, *end;
> > +
> > + for (start = str; *start; start++) {
> > + if (!isspace((unsigned char) start[0]))
> > + break;
> > + }
> > +
> > + for (end = start + strlen(start); end > start + 1; end--) {
> > + if (!isspace((unsigned char) end[-1]))
> > + break;
> > + }
> > +
>
> Why not use existing string functions like strspn?
Had no particular reason not to use strspn. This was in use/tested in two apps
shipping already, and I took the easy route. I could modify if you think it
will be better.