public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Heikki Linnakangas <[email protected]>
To: [email protected]
Subject: Re: pgsql: Make cancel request keys longer
Date: Wed, 9 Apr 2025 11:39:49 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On 09.04.25 10:53, Heikki Linnakangas wrote:
> On 08/04/2025 22:41, Heikki Linnakangas wrote:
>> On 08/04/2025 20:06, Peter Eisentraut wrote:
>>> While I was looking at this, I suggest to make the first argument 
>>> void *.  This is consistent for passing binary data.
>>
>> Ok, sure.
> 
> On second thoughts, -1 on that. 'void *' is appropriate for functions 
> like libc's read() or pq_sendbytes(), where the buffer can point to 
> anything. In other words, the caller is expected to have a pointer like 
> 'foobar *', and it gets cast to 'void *' when you call the function. 
> That's not the case with the cancellation key. The cancellation key is 
> just an array of bytes, the caller is expected to pass an array of 
> bytes, not a struct.
> 
> The right precedent for that are e.g. SCRAM functions in scram-common.h, 
> for example. They use "const uint8 *" for the hashes.
> 
> I'll switch to "const uint *" everywhere that deals with cancel keys. 
> There are a few more variables elsewhere in the backend and in libpq.

I was having the same second thoughts overnight.  I agree with your 
conclusion.






view thread (11+ 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: pgsql: Make cancel request keys longer
  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