DPDK patches and discussions
 help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: Rich Lane <rich.lane@bigswitch.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] cfgfile: support looking up sections by index
Date: Thu, 21 Jan 2016 09:42:15 +0200	[thread overview]
Message-ID: <56A08BD7.9060504@redhat.com> (raw)
In-Reply-To: <1453178510-113435-1-git-send-email-rlane@bigswitch.com>

On 01/19/2016 06:41 AM, Rich Lane wrote:
> This is useful when sections have duplicate names.
>
> Signed-off-by: Rich Lane <rlane@bigswitch.com>
> ---
> 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 -

  reply	other threads:[~2016-01-21  7:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17  3:58 [dpdk-dev] [PATCH] " Rich Lane
2016-01-18 12:58 ` Panu Matilainen
2016-01-19  4:41 ` [dpdk-dev] [PATCH v2] " Rich Lane
2016-01-21  7:42   ` Panu Matilainen [this message]
2016-02-02 15:10   ` Dumitrescu, Cristian
2016-02-10 19:13     ` Rich Lane
2016-02-10 19:12   ` [dpdk-dev] [PATCH v3] " Rich Lane
2016-02-16 20:48     ` Dumitrescu, Cristian
2016-02-16 22:58     ` [dpdk-dev] [PATCH v4] " Rich Lane
2016-02-19 15:18       ` Dumitrescu, Cristian
2016-02-22 20:30       ` [dpdk-dev] [PATCH v5] " Rich Lane
2016-02-23  0:12         ` Dumitrescu, Cristian
2016-02-25 20:43         ` [dpdk-dev] [PATCH v6] " Rich Lane
2016-02-25 20:49           ` Dumitrescu, Cristian
2016-02-29 10:29             ` Thomas Monjalon

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=56A08BD7.9060504@redhat.com \
    --to=pmatilai@redhat.com \
    --cc=dev@dpdk.org \
    --cc=rich.lane@bigswitch.com \
    /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).