DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ergin, Mesut A" <mesut.a.ergin@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "olivier.matz@6wind.com" <olivier.matz@6wind.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] kvargs: trim spaces at the beginning and end of key and values
Date: Thu, 16 May 2019 20:55:10 +0000	[thread overview]
Message-ID: <3615B82CA151CF42A86EDDD9846A8B38C7A79B66@ORSMSX112.amr.corp.intel.com> (raw)
In-Reply-To: <20190516093655.2606d732@hermes.lan>



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Thursday, May 16, 2019 9:37 AM
> To: Ergin, Mesut A <mesut.a.ergin@intel.com>
> Cc: olivier.matz@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.ergin@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.

  reply	other threads:[~2019-05-16 20:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16  5:41 Mesut Ali Ergin
2019-05-16  5:41 ` Mesut Ali Ergin
2019-05-16 16:36 ` Stephen Hemminger
2019-05-16 20:55   ` Ergin, Mesut A [this message]
2019-05-16 23:18     ` Stephen Hemminger
2019-07-01 13:10 ` Olivier Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3615B82CA151CF42A86EDDD9846A8B38C7A79B66@ORSMSX112.amr.corp.intel.com \
    --to=mesut.a.ergin@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).