pgsql: Make DatumGetFoo/PG_GETARG_FOO/PG_RETURN_FOO macro names more co

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make DatumGetFoo/PG_GETARG_FOO/PG_RETURN_FOO macro names more co
Date: 2017-09-18 19:21:35
Message-ID: E1du1br-0006Lv-In@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make DatumGetFoo/PG_GETARG_FOO/PG_RETURN_FOO macro names more consistent.

By project convention, these names should include "P" when dealing with a
pointer type; that is, if the result of a GETARG macro is of type FOO *,
it should be called PG_GETARG_FOO_P not just PG_GETARG_FOO. Some newer
types such as JSONB and ranges had not followed the convention, and a
number of contrib modules hadn't gotten that memo either. Rename the
offending macros to improve consistency.

In passing, fix a few places that thought PG_DETOAST_DATUM() returns
a Datum; it does not, it returns "struct varlena *". Applying
DatumGetPointer to that happens not to cause any bad effects today,
but it's formally wrong. Also, adjust an ltree macro that was designed
without any thought for what pgindent would do with it.

This is all cosmetic and shouldn't have any impact on generated code.

Mark Dilger, some further tweaks by me

Discussion: https://postgr.es/m/EA5676F4-766F-4F38-8348-ECC7DB427C6A@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4bd1994650fddf49e717e35f1930d62208845974

Modified Files
--------------
contrib/btree_gist/btree_text.c | 2 +-
contrib/btree_gist/btree_utils_var.c | 6 +-
contrib/cube/cube.c | 151 +++++++++++++-------------
contrib/cube/cubedata.h | 6 +-
contrib/hstore/hstore.h | 2 +-
contrib/hstore/hstore_gin.c | 4 +-
contrib/hstore/hstore_gist.c | 2 +-
contrib/hstore/hstore_io.c | 14 +--
contrib/hstore/hstore_op.c | 50 ++++-----
contrib/hstore_plperl/hstore_plperl.c | 2 +-
contrib/hstore_plpython/hstore_plpython.c | 2 +-
contrib/ltree/_ltree_gist.c | 2 +-
contrib/ltree/_ltree_op.c | 16 +--
contrib/ltree/lquery_op.c | 6 +-
contrib/ltree/ltree.h | 21 +++-
contrib/ltree/ltree_gist.c | 26 ++---
contrib/ltree/ltree_io.c | 4 +-
contrib/ltree/ltree_op.c | 68 ++++++------
contrib/ltree/ltxtquery_io.c | 2 +-
contrib/ltree/ltxtquery_op.c | 4 +-
contrib/ltree_plpython/ltree_plpython.c | 2 +-
src/backend/tsearch/to_tsany.c | 6 +-
src/backend/tsearch/wparser.c | 4 +-
src/backend/utils/adt/array_expanded.c | 4 +-
src/backend/utils/adt/arrayfuncs.c | 46 ++++----
src/backend/utils/adt/jsonb.c | 8 +-
src/backend/utils/adt/jsonb_gin.c | 12 +-
src/backend/utils/adt/jsonb_op.c | 48 ++++----
src/backend/utils/adt/jsonfuncs.c | 94 ++++++++--------
src/backend/utils/adt/rangetypes.c | 134 +++++++++++------------
src/backend/utils/adt/rangetypes_gist.c | 96 ++++++++--------
src/backend/utils/adt/rangetypes_selfuncs.c | 4 +-
src/backend/utils/adt/rangetypes_spgist.c | 54 ++++-----
src/backend/utils/adt/rangetypes_typanalyze.c | 2 +-
src/backend/utils/adt/tsgistidx.c | 4 +-
src/include/utils/array.h | 4 +-
src/include/utils/jsonb.h | 8 +-
src/include/utils/rangetypes.h | 12 +-
38 files changed, 471 insertions(+), 461 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-09-18 19:33:29 Re: Re: [COMMITTERS] pgsql: Perform only one ReadControlFile() during startup.
Previous Message Andres Freund 2017-09-18 18:04:39 Re: Re: [COMMITTERS] pgsql: Perform only one ReadControlFile() during startup.