From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Replace remaining StrNCpy() by strlcpy()
Date: Mon, 10 Aug 2020 22:09:21 +0000
Message-ID: <E1k5Fyr-000725-2t@gemulon.postgresql.org> (raw)
Replace remaining StrNCpy() by strlcpy()
They are equivalent, except that StrNCpy() zero-fills the entire
destination buffer instead of providing just one trailing zero. For
all but a tiny number of callers, that's just overhead rather than
being desirable.
Remove StrNCpy() as it is now unused.
In some cases, namestrcpy() is the more appropriate function to use.
While we're here, simplify the API of namestrcpy(): Remove the return
value, don't check for NULL input. Nothing was using that anyway.
Also, remove a few unused name-related functions.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/44f5e198-36f6-6cdb-7fa9-60e34784daae%402ndquadrant.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1784f278a63866cc144fcd0a2127cadba6a2b7f8
Modified Files
--------------
contrib/pgcrypto/crypt-des.c | 2 +-
src/backend/access/transam/slru.c | 2 +-
src/backend/access/transam/xlogarchive.c | 2 +-
src/backend/catalog/pg_constraint.c | 2 +-
src/backend/commands/indexcmds.c | 2 +-
src/backend/commands/statscmds.c | 2 +-
src/backend/commands/tablecmds.c | 2 +-
src/backend/postmaster/pgstat.c | 2 +-
src/backend/replication/logical/logical.c | 11 ++++-
src/backend/replication/slot.c | 2 +-
src/backend/utils/adt/formatting.c | 8 ++--
src/backend/utils/adt/name.c | 48 ++--------------------
src/backend/utils/adt/pg_locale.c | 9 ----
src/backend/utils/adt/ruleutils.c | 2 +-
src/common/exec.c | 4 +-
src/include/c.h | 29 -------------
src/include/utils/builtins.h | 3 +-
src/interfaces/ecpg/pgtypeslib/dt_common.c | 4 +-
src/interfaces/ecpg/test/pg_regress_ecpg.c | 2 +-
.../ssl_passphrase_callback/ssl_passphrase_func.c | 2 +-
20 files changed, 34 insertions(+), 106 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Replace remaining StrNCpy() by strlcpy()
In-Reply-To: <E1k5Fyr-000725-2t@gemulon.postgresql.org>
References: <E1k5Fyr-000725-2t@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