Thread: [COMMITTERS] pgsql: Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h.
[COMMITTERS] pgsql: Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h.
From
Andres Freund
Date:
Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h. All postgres internal usages are replaced, it's just libpq example usages that haven't been converted. External users of libpq can't generally rely on including postgres internal headers. Note that this includes replacing open-coded byte swapping of 64bit integers (using two 32 bit swaps) with a single 64bit swap. Where it looked applicable, I have removed netinet/in.h and arpa/inet.h usage, which previously provided the relevant functionality. It's perfectly possible that I missed other reasons for including those, the buildfarm will tell. Author: Andres Freund Discussion: https://postgr.es/m/20170927172019.gheidqy6xvlxb325@alap3.anarazel.de Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0ba99c84e8c7138143059b281063d4cca5a2bfea Modified Files -------------- contrib/pgcrypto/crypt-des.c | 17 +++++++--------- contrib/uuid-ossp/uuid-ossp.c | 17 +++++++--------- src/backend/commands/copy.c | 11 +++++----- src/backend/libpq/auth.c | 18 ++++++++--------- src/backend/libpq/ifaddr.c | 6 +++--- src/backend/libpq/pqcomm.c | 6 +++--- src/backend/libpq/pqformat.c | 40 ++++++++++--------------------------- src/backend/postmaster/postmaster.c | 13 ++++++------ src/backend/tcop/fastpath.c | 8 +++----- src/bin/pg_basebackup/streamutil.c | 34 +++++++------------------------ src/bin/pg_dump/parallel.c | 6 ++++-- src/bin/pg_rewind/libpq_fetch.c | 29 ++------------------------- src/common/scram-common.c | 7 ++----- src/interfaces/libpq/fe-connect.c | 12 +++++------ src/interfaces/libpq/fe-lobj.c | 11 +++++----- src/interfaces/libpq/fe-misc.c | 14 ++++++------- src/interfaces/libpq/fe-protocol2.c | 5 ++--- src/interfaces/libpq/fe-protocol3.c | 5 ++--- src/port/getaddrinfo.c | 11 +++++----- src/port/inet_aton.c | 4 +++- 20 files changed, 99 insertions(+), 175 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers
Re: [COMMITTERS] pgsql: Replace most usages of ntoh[ls] and hton[sl]with pg_bswap.h.
From
Michael Paquier
Date:
On Mon, Oct 2, 2017 at 8:08 AM, Andres Freund <andres@anarazel.de> wrote: > Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h. > > All postgres internal usages are replaced, it's just libpq example > usages that haven't been converted. External users of libpq can't > generally rely on including postgres internal headers. > > Note that this includes replacing open-coded byte swapping of 64bit > integers (using two 32 bit swaps) with a single 64bit swap. > > Where it looked applicable, I have removed netinet/in.h and > arpa/inet.h usage, which previously provided the relevant > functionality. It's perfectly possible that I missed other reasons for > including those, the buildfarm will tell. Thanks for taking the time to improve that! I was looking for a 64b equivalent not long ago for pg_rewind... Those changes look good to me at quick glance. -- Michael -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers