From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CF44CA00E6 for ; Fri, 17 May 2019 01:18:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7279856A3; Fri, 17 May 2019 01:18:39 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 529504CAB for ; Fri, 17 May 2019 01:18:38 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id 13so2626294pfw.9 for ; Thu, 16 May 2019 16:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0eCcXRgcjDkwLDFcor3ee4xI8ziEH+IGj+2vRQKZ8UE=; b=seSI2PvWCCw/Mxg/bgFKLmXPaRU1G1zT88cDjXGODUf9HtZ9lk2nsTGYF3a1IjBumW SDwFOmGZ+TzNf4mmpwIGMleMc91NdfvV+Ic+v6PafU1gfHqYat6Bi99XgylPgyXP8S0y 9gX2OAvP3AzztSpUBxaIgM2VdTGwmnGzzmUTpATIavHx5rQrIKek7xDXZPNz/eJemmU8 9V/Ww0tbjxZZnqG52yYnM1na2/sHbcPrEx/ASPuzY5dE8CLzyCGOs7T+od9LajiYUqBf qKBtZsI+9LhucoWREhw3GafB+uxgN4x2oU9SE2hnNq0rrySTaZlCs25VcQAlJQvCIeHP LffQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0eCcXRgcjDkwLDFcor3ee4xI8ziEH+IGj+2vRQKZ8UE=; b=IAIc0qViPykRBlKAUjB6BcnF0LoaC6pazcs2Blu3oe0lfcL7LfvFS8U7FAfeqCb4oF h4S6D7eHq4WAlHNvCH4WGE3gB+jYEDVR4SI9f6GimGdeu1itjH/T66KwQC7k1P5oB+hX MWPWD9eUiRazEsuP8acK1zWLFNKfXA/hO2nTKzNlZiyKM9lqB0cRyA6g8v3aDA2rp66z JNb0CKvB37gZ82uGoIwdB6pgSDEiS9n8Traf2Lo/bxM6Uko8vAoaL2HKE0oUimuwKF28 kCSPTxdc2rlLtkU44ON7Qn1zMx89Hkp+PFVBtuXSv6hUQJY7dsrmeHdMiCHcc/wUOzjn wx5A== X-Gm-Message-State: APjAAAV0cODS9nDtEvk4ld7jZJWBHCFinhmWS0xY+ldfKGS8qUkoKyn4 KfojS8GZyJVOifWPZRFXEkrD8Dygt10= X-Google-Smtp-Source: APXvYqymSlU7ljr/HO4BwD/h1F/3DQ11GTRG3LiFYNvisnhvQ0/+Eb6aYXaQ8WVdnG5meccTN9xeWQ== X-Received: by 2002:a63:5742:: with SMTP id h2mr52841282pgm.194.1558048717440; Thu, 16 May 2019 16:18:37 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 37sm10696224pgn.21.2019.05.16.16.18.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2019 16:18:37 -0700 (PDT) Date: Thu, 16 May 2019 16:18:35 -0700 From: Stephen Hemminger To: "Ergin, Mesut A" Cc: "olivier.matz@6wind.com" , "dev@dpdk.org" Message-ID: <20190516161835.10d010e0@hermes.lan> In-Reply-To: <3615B82CA151CF42A86EDDD9846A8B38C7A79B66@ORSMSX112.amr.corp.intel.com> References: <1557985267-280205-1-git-send-email-mesut.a.ergin@intel.com> <20190516093655.2606d732@hermes.lan> <3615B82CA151CF42A86EDDD9846A8B38C7A79B66@ORSMSX112.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] kvargs: trim spaces at the beginning and end of key and values X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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, 16 May 2019 20:55:10 +0000 "Ergin, Mesut A" wrote: > > -----Original Message----- > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Thursday, May 16, 2019 9:37 AM > > To: Ergin, Mesut A > > 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 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. writing your own string handling code is often a source of bugs