Message ID | 1469526749-19698-1-git-send-email-wei.dai@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 922A658D8; Tue, 26 Jul 2016 11:54:03 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 108ED58D6 for <dev@dpdk.org>; Tue, 26 Jul 2016 11:54:02 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 26 Jul 2016 02:54:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,424,1464678000"; d="scan'208"; a="1024053407" Received: from dpdk2.bj.intel.com ([172.16.182.189]) by orsmga002.jf.intel.com with ESMTP; 26 Jul 2016 02:54:00 -0700 From: Wei Dai <wei.dai@intel.com> To: dev@dpdk.org Cc: Wei Dai <wei.dai@intel.com> Date: Tue, 26 Jul 2016 17:52:29 +0800 Message-Id: <1469526749-19698-1-git-send-email-wei.dai@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1469081018-55300-1-git-send-email-wei.dai@intel.com> References: <1469081018-55300-1-git-send-email-wei.dai@intel.com> Subject: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse --lcores X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Wei Dai
July 26, 2016, 9:52 a.m. UTC
local variable i is not referred by other codes in
the function eal_parse_lcores( ), so it can be removed.
Signed-off-by: Wei Dai <wei.dai@intel.com>
---
lib/librte_eal/common/eal_common_options.c | 4 ----
1 file changed, 4 deletions(-)
Comments
> -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai > Sent: Tuesday, July 26, 2016 10:52 AM > To: dev@dpdk.org > Cc: Dai, Wei <wei.dai@intel.com> > Subject: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse --lcores > > local variable i is not referred by other codes in the function eal_parse_lcores( ), so it can be removed. > > Signed-off-by: Wei Dai <wei.dai@intel.com> > --- > lib/librte_eal/common/eal_common_options.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c > index 481c732..c5bf98c 100644 > --- a/lib/librte_eal/common/eal_common_options.c > +++ b/lib/librte_eal/common/eal_common_options.c > @@ -578,7 +578,6 @@ eal_parse_lcores(const char *lcores) > struct rte_config *cfg = rte_eal_get_configuration(); > static uint16_t set[RTE_MAX_LCORE]; > unsigned idx = 0; > - int i; > unsigned count = 0; > const char *lcore_start = NULL; > const char *end = NULL; > @@ -593,9 +592,6 @@ eal_parse_lcores(const char *lcores) > /* Remove all blank characters ahead and after */ > while (isblank(*lcores)) > lcores++; > - i = strlen(lcores); > - while ((i > 0) && isblank(lcores[i - 1])) > - i--; I suppose originally it meant to do something like that: while ((i > 0) && isblank(lcores[i - 1])) lcores[i--] = 0; to get rid of blank characters at the end of the line, no? Konstantin > > CPU_ZERO(&cpuset); > > -- > 2.5.5
On Tue, Jul 26, 2016 at 11:51:57AM +0000, Ananyev, Konstantin wrote: > > hi Wei, > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai > > Sent: Tuesday, July 26, 2016 10:52 AM > > To: dev@dpdk.org > > Cc: Dai, Wei <wei.dai@intel.com> > > Subject: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse --lcores > > > > local variable i is not referred by other codes in the function eal_parse_lcores( ), so it can be removed. > > > > Signed-off-by: Wei Dai <wei.dai@intel.com> > > --- > > lib/librte_eal/common/eal_common_options.c | 4 ---- > > 1 file changed, 4 deletions(-) > > > > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c > > index 481c732..c5bf98c 100644 > > --- a/lib/librte_eal/common/eal_common_options.c > > +++ b/lib/librte_eal/common/eal_common_options.c > > @@ -578,7 +578,6 @@ eal_parse_lcores(const char *lcores) > > struct rte_config *cfg = rte_eal_get_configuration(); > > static uint16_t set[RTE_MAX_LCORE]; > > unsigned idx = 0; > > - int i; > > unsigned count = 0; > > const char *lcore_start = NULL; > > const char *end = NULL; > > @@ -593,9 +592,6 @@ eal_parse_lcores(const char *lcores) > > /* Remove all blank characters ahead and after */ > > while (isblank(*lcores)) > > lcores++; > > - i = strlen(lcores); > > - while ((i > 0) && isblank(lcores[i - 1])) > > - i--; > > I suppose originally it meant to do something like that: > while ((i > 0) && isblank(lcores[i - 1])) > lcores[i--] = 0; totally agreed Konstantin, need to add lcore[i--] = '\0' > > to get rid of blank characters at the end of the line, no? > Konstantin > > > > > CPU_ZERO(&cpuset); > > > > -- > > 2.5.5 Adam Bynes
Hi, Adam & Ananyev Thanks for your feedback. > -----Original Message----- > From: Adam Bynes [mailto:adambynes@outlook.com] > Sent: Wednesday, July 27, 2016 1:36 AM > To: Dai, Wei <wei.dai@intel.com>; Ananyev, Konstantin > <konstantin.ananyev@intel.com> > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse > --lcores > > On Tue, Jul 26, 2016 at 11:51:57AM +0000, Ananyev, Konstantin wrote: > > > > > hi Wei, > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai > > > Sent: Tuesday, July 26, 2016 10:52 AM > > > To: dev@dpdk.org > > > Cc: Dai, Wei <wei.dai@intel.com> > > > Subject: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse > --lcores > > > > > > local variable i is not referred by other codes in the function > eal_parse_lcores( ), so it can be removed. > > > > > > Signed-off-by: Wei Dai <wei.dai@intel.com> > > > --- > > > lib/librte_eal/common/eal_common_options.c | 4 ---- > > > 1 file changed, 4 deletions(-) > > > > > > diff --git a/lib/librte_eal/common/eal_common_options.c > b/lib/librte_eal/common/eal_common_options.c > > > index 481c732..c5bf98c 100644 > > > --- a/lib/librte_eal/common/eal_common_options.c > > > +++ b/lib/librte_eal/common/eal_common_options.c > > > @@ -578,7 +578,6 @@ eal_parse_lcores(const char *lcores) > > > struct rte_config *cfg = rte_eal_get_configuration(); > > > static uint16_t set[RTE_MAX_LCORE]; > > > unsigned idx = 0; > > > - int i; > > > unsigned count = 0; > > > const char *lcore_start = NULL; > > > const char *end = NULL; > > > @@ -593,9 +592,6 @@ eal_parse_lcores(const char *lcores) > > > /* Remove all blank characters ahead and after */ > > > while (isblank(*lcores)) > > > lcores++; > > > - i = strlen(lcores); > > > - while ((i > 0) && isblank(lcores[i - 1])) > > > - i--; > > > > I suppose originally it meant to do something like that: > > while ((i > 0) && isblank(lcores[i - 1])) > > lcores[i--] = 0; > totally agreed Konstantin, need to add lcore[i--] = '\0' > > > > > to get rid of blank characters at the end of the line, no? > > Konstantin The tail blank is not necessary to be removed from lcores here for following reasons: 1. The tail blanks can also be swallowed later in function eal_parse_set( ) by "while (isblank(*end)) end++". And such operation/sentence also deal with blanks in the middle of arguments (for example: blank before - and after (7,8) in '0 -2 ,(3 - 6)@(3-6),7@(7-8) ,8@(8-10) '), so above removal of blank is redundant. By the way, with --lcores '(0-3)@(0-3), (4-5)@(4-5) ', I also find a new bug. After processing cpu set (4-5), the variable end in eal_parse_lcores doesn't point t ',' or '\0', so this function return an error. The tail blank after cpu set (4-5) still need to be swallowed. The patch v3 will be removed.eal 2. if let lcores[i--] = 0 here, due to type of input argument lcores (const char *), building will fail. And if the type is changed to char *, the type of input argument of several other function also need to be changed. So according to above reason 1, it is not need to change the type. Thanks Wei Dai > > > > > > > > CPU_ZERO(&cpuset); > > > > > > -- > > > 2.5.5 > Adam Bynes
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 481c732..c5bf98c 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -578,7 +578,6 @@ eal_parse_lcores(const char *lcores) struct rte_config *cfg = rte_eal_get_configuration(); static uint16_t set[RTE_MAX_LCORE]; unsigned idx = 0; - int i; unsigned count = 0; const char *lcore_start = NULL; const char *end = NULL; @@ -593,9 +592,6 @@ eal_parse_lcores(const char *lcores) /* Remove all blank characters ahead and after */ while (isblank(*lcores)) lcores++; - i = strlen(lcores); - while ((i > 0) && isblank(lcores[i - 1])) - i--; CPU_ZERO(&cpuset);