public inbox for [email protected]  
help / color / mirror / Atom feed
From: Noah Misch <[email protected]>
To: Tom Lane <[email protected]>
To: Zhihong Yu <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: null iv parameter passed to combo_init()
Date: Sun, 9 Jan 2022 08:48:54 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CALNJ-vTuaO+6hM4wY2aE0V7WdB56bwTXDp50Bn2U1ggmonVGbA@mail.gmail.com>
References: <CALNJ-vSBb2Ees=KB0frYBh7foK-QNZMbK7Vz66bUJa09D+CHAw@mail.gmail.com>
	<[email protected]>
	<CALNJ-vTh9BXARHg3iaCAzr97Fws2W5aR6nRPJfT4u3VdKDzRTQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CALNJ-vTuaO+6hM4wY2aE0V7WdB56bwTXDp50Bn2U1ggmonVGbA@mail.gmail.com>

On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wrote:
> On Sat, Jan 8, 2022 at 11:32 PM Tom Lane <[email protected]> wrote:
> > Noah Misch <[email protected]> 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?






view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: null iv parameter passed to combo_init()
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox