pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use 'void *' for arbitrary buffers, 'uint8 *' for byte arrays
Date: Thu, 08 May 2025 19:11:02 +0000
Message-ID: <E1uD6e6-000omO-1n@gemulon.postgresql.org> (raw)

Use 'void *' for arbitrary buffers, 'uint8 *' for byte arrays

A 'void *' argument suggests that the caller might pass an arbitrary
struct, which is appropriate for functions like libc's read/write, or
pq_sendbytes(). 'uint8 *' is more appropriate for byte arrays that
have no structure, like the cancellation keys or SCRAM tokens. Some
places used 'char *', but 'uint8 *' is better because 'char *' is
commonly used for null-terminated strings. Change code around SCRAM,
MD5 authentication, and cancellation key handling to follow these
conventions.

Discussion: https://www.postgresql.org/message-id/61be9e31-7b7d-49d5-bc11-721800d89d64@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b28c59a6cd089902e66a91e0d0974da34d1c922b

Modified Files
--------------
contrib/dblink/dblink.c              |  4 ++--
contrib/postgres_fdw/connection.c    |  4 ++--
src/backend/libpq/auth-scram.c       | 32 ++++++++++++++++----------------
src/backend/libpq/auth.c             |  4 ++--
src/backend/libpq/crypt.c            |  6 +++---
src/backend/storage/ipc/procsignal.c |  6 +++---
src/backend/utils/init/globals.c     |  2 +-
src/common/base64.c                  | 16 ++++++++--------
src/common/md5_common.c              |  4 ++--
src/common/scram-common.c            | 10 +++++-----
src/include/common/base64.h          |  4 ++--
src/include/common/md5.h             |  4 ++--
src/include/common/scram-common.h    |  4 ++--
src/include/libpq/auth.h             |  2 +-
src/include/libpq/crypt.h            |  2 +-
src/include/libpq/pqcomm.h           |  2 +-
src/include/miscadmin.h              |  2 +-
src/include/storage/procsignal.h     |  4 ++--
src/interfaces/libpq/fe-auth-scram.c | 14 +++++++-------
src/interfaces/libpq/fe-auth.c       |  8 ++++----
src/interfaces/libpq/fe-cancel.c     |  2 +-
src/interfaces/libpq/fe-misc.c       | 10 +++++-----
src/interfaces/libpq/fe-protocol3.c  |  4 ++--
src/interfaces/libpq/libpq-int.h     | 10 +++++-----
24 files changed, 80 insertions(+), 80 deletions(-)



Message-ID: <E1uD6e6-000omO-1n@gemulon.postgresql.org>
Permalink:  ../E1uD6e6-000omO-1n@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uD6e6-000omO-1n@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use 'void *' for arbitrary buffers, 'uint8 *' for byte arrays
  In-Reply-To: <E1uD6e6-000omO-1n@gemulon.postgresql.org>

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

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