> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, September 1, 2015 4:59 AM
> To: Dumitrescu, Cristian
> Cc: dev at dpdk.org; Stephen Hemminger
> Subject: [PATCH 4/5] examples_ip_pipeline: remove useless code
> 
> Code here checks return from strdup() in only one place in this
> whole module, and then does nothing useful by setting one
> value that is then cleared. Just remove the check.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  examples/ip_pipeline/config_parse.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/examples/ip_pipeline/config_parse.c
> b/examples/ip_pipeline/config_parse.c
> index 6b651a8..81ec33b 100644
> --- a/examples/ip_pipeline/config_parse.c
> +++ b/examples/ip_pipeline/config_parse.c
> @@ -1483,9 +1483,6 @@ parse_tm(struct app_params *app,
>               ret = -ESRCH;
>               if (strcmp(ent->name, "cfg") == 0) {
>                       param->file_name = strdup(ent->value);
> -                     if (param->file_name == NULL)
> -                             ret = -EINVAL;
> -
>                       ret = 0;

The required implementation would actually be:

        if (param->file_name == NULL)
                ret = -EINVAL;
        else
                ret = 0;

The TM parameter file_name is used by function app_config_parse_tm() in file 
config_parse_tm.c.

Regarding the way the error management (including the error messages) is done 
in our parser (currently done by repeatedly setting the ret variable), I would 
like to improve (replace) when I get the time to take another look at this.

>               } else if (strcmp(ent->name, "burst_read") == 0)
>                       ret = parser_read_uint32(&param->burst_read,
> --
> 2.1.4

Reply via email to