Re: add non-option reordering to in-tree getopt_long

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: add non-option reordering to in-tree getopt_long
Дата
Msg-id 20230710.165711.1906730109995973216.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на Re: add non-option reordering to in-tree getopt_long  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: add non-option reordering to in-tree getopt_long  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
At Fri, 7 Jul 2023 20:52:24 -0700, Nathan Bossart <nathandbossart@gmail.com> wrote in 
> I spent some time tidying up the patch and adding a more detailed commit
> message.

The commit message and the change to TAP script looks good.


Two conditions are to be reversed and one of them look somewhat
unintuitive to me.

+            if (!force_nonopt && place[0] == '-' && place[1])
+            {
+                if (place[1] != '-' || place[2])
+                    break;
+
+                optind++;
+                force_nonopt = true;
+                continue;
+            }

The first if looks good to me, but the second if is a bit hard to get the meaning at a glance. "!(place[1] == '-' &&
place[2]== 0)" is easier to read *to me*. Or I'm fine with the following structure here.
 

> if (!force_nonopt ... )
> {
>   if (place[1] == '-' && place[2] == 0)
>   {
>      optind+;
>      force_nonopt = true;
>      continue;
>   }
>   break;
> }

(To be honest, I see the goto looked clear than for(;;)..)

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "王伟(学弈)"
Дата:
Сообщение: Check invalid pages at the end of recovery to alarm lost data
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: pg_usleep for multisecond delays