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