On Wed, 18 Sep 2024 15:18:04 +0800
fengchengwen <fengcheng...@huawei.com> wrote:

> > +/* Parse the all arguments looking for log related ones */
> > +int
> > +eal_log_level_parse(int argc, char * const argv[])
> > +{
> > +   struct internal_config *internal_conf = 
> > eal_get_internal_configuration();
> > +   int option_index, opt;
> > +   const int old_optind = optind;
> > +   const int old_optopt = optopt;
> > +   const int old_opterr = opterr;
> > +   char *old_optarg = optarg;
> > +#ifdef RTE_EXEC_ENV_FREEBSD
> > +   const int old_optreset = optreset;
> > +   optreset = 1;
> > +#endif
> > +
> > +   optind = 1;
> > +   opterr = 0;
> > +
> > +   while ((opt = getopt_long(argc, argv, eal_short_options,
> > +                             eal_long_options, &option_index)) != EOF) {
> > +
> > +           switch (opt) {
> > +           case OPT_LOG_LEVEL_NUM:
> > +                   if (eal_parse_common_option(opt, optarg, internal_conf) 
> > < 0)
> > +                           return -1;
> > +                   break;
> > +           case '?':
> > +                   /* getopt is not happy, stop right now */
> > +                   goto out;  
> 
> no need goto, could use break

This function is only used to pre-scan options, it should just ignore
anything it doesn't care about. Can remove the ? case and default part.

Reply via email to