diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-09-18 15:21:23 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-09-18 15:21:23 -0400 |
commit | 4bd1994650fddf49e717e35f1930d62208845974 (patch) | |
tree | 0c6353be3e707d1ccfc7bca07ca87ca5fed1bcd8 /src/include/utils/array.h | |
parent | 3e1683d37e1d751eb2df9a5cb0507bebc6cf7d05 (diff) |
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
Diffstat (limited to 'src/include/utils/array.h')
-rw-r--r-- | src/include/utils/array.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/utils/array.h b/src/include/utils/array.h index 61a67a21e36..d6d3c582b6a 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -252,7 +252,7 @@ typedef struct ArrayIteratorData *ArrayIterator; #define PG_RETURN_EXPANDED_ARRAY(x) PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr)) /* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */ -#define PG_GETARG_ANY_ARRAY(n) DatumGetAnyArray(PG_GETARG_DATUM(n)) +#define PG_GETARG_ANY_ARRAY_P(n) DatumGetAnyArrayP(PG_GETARG_DATUM(n)) /* * Access macros for varlena array header fields. @@ -440,7 +440,7 @@ extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext, extern ExpandedArrayHeader *DatumGetExpandedArray(Datum d); extern ExpandedArrayHeader *DatumGetExpandedArrayX(Datum d, ArrayMetaState *metacache); -extern AnyArrayType *DatumGetAnyArray(Datum d); +extern AnyArrayType *DatumGetAnyArrayP(Datum d); extern void deconstruct_expanded_array(ExpandedArrayHeader *eah); #endif /* ARRAY_H */ |