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 4A071A00E6 for ; Thu, 16 May 2019 22:55:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 24ACD5B12; Thu, 16 May 2019 22:55:14 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id D8D9D58EC for ; Thu, 16 May 2019 22:55:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2019 13:55:11 -0700 X-ExtLoop1: 1 Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by fmsmga004.fm.intel.com with ESMTP; 16 May 2019 13:55:11 -0700 Received: from orsmsx112.amr.corp.intel.com ([169.254.3.79]) by ORSMSX107.amr.corp.intel.com ([169.254.1.194]) with mapi id 14.03.0415.000; Thu, 16 May 2019 13:55:11 -0700 From: "Ergin, Mesut A" To: Stephen Hemminger CC: "olivier.matz@6wind.com" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kvargs: trim spaces at the beginning and end of key and values Thread-Index: AQHVC6oIjdfcpnyQ00qj29gu7opIGaZuaSmA///ReIA= Date: Thu, 16 May 2019 20:55:10 +0000 Message-ID: <3615B82CA151CF42A86EDDD9846A8B38C7A79B66@ORSMSX112.amr.corp.intel.com> References: <1557985267-280205-1-git-send-email-mesut.a.ergin@intel.com> <20190516093655.2606d732@hermes.lan> In-Reply-To: <20190516093655.2606d732@hermes.lan> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjMzZDQ0NWYtOTNmZi00N2U4LThiZGUtYmUwNDI3YzE3MzkyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibkxJdzFocUM4Qm5SdVNJN1lIZlREOEszOUxCcDlITTlcL0ZuTlp3ZDhydEsrV3hBOWY1blpDdHdLM0g4anRNZ24ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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" > -----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 >=20 > On Wed, 15 May 2019 22:41:07 -0700 > Mesut Ali Ergin wrote: >=20 > > +/* trim leading and trailing spaces */ > > +static char * > > +trim_space(char *str) > > +{ > > + char *start, *end; > > + > > + for (start =3D str; *start; start++) { > > + if (!isspace((unsigned char) start[0])) > > + break; > > + } > > + > > + for (end =3D start + strlen(start); end > start + 1; end--) { > > + if (!isspace((unsigned char) end[-1])) > > + break; > > + } > > + >=20 > Why not use existing string functions like strspn? Had no particular reason not to use strspn. This was in use/tested in two a= pps shipping already, and I took the easy route. I could modify if you thin= k it will be better.