Re: null iv parameter passed to combo_init()

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: null iv parameter passed to combo_init()
Дата
Msg-id 20220109164854.GA309234@rfd.leadboat.com
обсуждение исходный текст
Ответ на Re: null iv parameter passed to combo_init()  (Zhihong Yu <zyu@yugabyte.com>)
Ответы Re: null iv parameter passed to combo_init()  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: null iv parameter passed to combo_init()  (Zhihong Yu <zyu@yugabyte.com>)
Список pgsql-hackers
On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wrote:
> On Sat, Jan 8, 2022 at 11:32 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Noah Misch <noah@leadboat.com> writes:
> > > On further thought, I would write it this way:
> >
> > > -             else
> > > +             else if (ivlen != 0)
> > >                       memcpy(ivbuf, iv, ivlen);
> >
> > FWIW, I liked the "ivlen > 0" formulation better.  They should be
> > equivalent, because ivlen is unsigned, but it just seems like "> 0"
> > is more natural.

If I were considering the one code site in isolation, I'd pick "ivlen > 0".
But of the four sites identified so far, three have signed length variables.
Since we're likely to get more examples of this pattern, some signed and some
unsigned, I'd rather use a style that does the optimal thing whether or not
the variable is signed.  What do you think?

> Patch v4 is attached.

Does this pass the test procedure shown upthread?



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

Предыдущее
От: "Wei Sun"
Дата:
Сообщение: Add lasterrno setting for dir_existsfile()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Why is src/test/modules/committs/t/002_standby.pl flaky?