From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Replace remaining StrNCpy() by strlcpy() |
Date: | 2020-08-10 22:09:21 |
Message-ID: | E1k5Fyr-000725-2t@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(at)sss(dot)pgh(dot)pa(dot)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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-08-11 05:38:30 | pgsql: Improve tab completion of REINDEX in psql |
Previous Message | Tom Lane | 2020-08-10 21:23:53 | pgsql: Stamp 9.5.23. |