From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 65DEB5A62 for ; Thu, 21 Jan 2016 08:42:16 +0100 (CET) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 9C5B4C0ED3F8; Thu, 21 Jan 2016 07:42:15 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org (vpn1-5-192.ams2.redhat.com [10.36.5.192]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0L7gEVH000466; Thu, 21 Jan 2016 02:42:14 -0500 To: Rich Lane , dev@dpdk.org References: <1453003104-19107-1-git-send-email-rlane@bigswitch.com> <1453178510-113435-1-git-send-email-rlane@bigswitch.com> From: Panu Matilainen Message-ID: <56A08BD7.9060504@redhat.com> Date: Thu, 21 Jan 2016 09:42:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1453178510-113435-1-git-send-email-rlane@bigswitch.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Subject: Re: [dpdk-dev] [PATCH v2] cfgfile: support looking up sections by index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2016 07:42:16 -0000 On 01/19/2016 06:41 AM, Rich Lane wrote: > This is useful when sections have duplicate names. > > Signed-off-by: Rich Lane > --- > v1->v2: > - Added new symbol to version script. > > lib/librte_cfgfile/rte_cfgfile.c | 16 ++++++++++++++++ > lib/librte_cfgfile/rte_cfgfile.h | 23 +++++++++++++++++++++++ > lib/librte_cfgfile/rte_cfgfile_version.map | 6 ++++++ > 3 files changed, 45 insertions(+) > > diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c > index a677dad..0bb40a4 100644 > --- a/lib/librte_cfgfile/rte_cfgfile.c > +++ b/lib/librte_cfgfile/rte_cfgfile.c > @@ -333,6 +333,22 @@ rte_cfgfile_section_entries(struct rte_cfgfile *cfg, const char *sectionname, > return i; > } > > +int > +rte_cfgfile_section_entries_by_index(struct rte_cfgfile *cfg, int index, > + struct rte_cfgfile_entry *entries, int max_entries) > +{ > + int i; > + const struct rte_cfgfile_section *sect; > + > + if (index >= cfg->num_sections) > + return -1; > + > + sect = cfg->sections[index]; Since index is a signed int, I think you should check for < 0 as well in the above. Sorry for not noticing/mentioning that on the first round, I wasn't so much reviewing the code as just skimming through for general API/ABI issues. Other than that, looks ok to me. - Panu -