Skip to content

Commit e8d7858

Browse files
committed
Revert "Convert *GetDatum() and DatumGet*() macros to inline functions"
This reverts commit 595836e. It has problems when USE_FLOAT8_BYVAL is off.
1 parent 595836e commit e8d7858

File tree

27 files changed

+190
-659
lines changed

27 files changed

+190
-659
lines changed

contrib/intarray/_int_gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ g_int_consistent(PG_FUNCTION_ARGS)
5151

5252
/* Oid subtype = PG_GETARG_OID(3); */
5353
bool *recheck = (bool *) PG_GETARG_POINTER(4);
54-
bool retval = false; /* silence compiler warning */
54+
bool retval;
5555

5656
/* this is exact except for RTSameStrategyNumber */
5757
*recheck = (strategy == RTSameStrategyNumber);

doc/src/sgml/xfunc.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2763,7 +2763,7 @@ c_overpaid(PG_FUNCTION_ARGS)
27632763
is null. <function>GetAttributeByName</function> returns a <type>Datum</type>
27642764
value that you can convert to the proper data type by using the
27652765
appropriate <function>DatumGet<replaceable>XXX</replaceable>()</function>
2766-
function. Note that the return value is meaningless if the null flag is
2766+
macro. Note that the return value is meaningless if the null flag is
27672767
set; always check the null flag before trying to do anything with the
27682768
result.
27692769
</para>

src/backend/access/gist/gistutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
280280
bool
281281
gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b)
282282
{
283-
bool result = false; /* silence compiler warning */
283+
bool result;
284284

285285
FunctionCall3Coll(&giststate->equalFn[attno],
286286
giststate->supportCollation[attno],

src/backend/tsearch/ts_parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void
354354
parsetext(Oid cfgId, ParsedText *prs, char *buf, int buflen)
355355
{
356356
int type,
357-
lenlemm = 0; /* silence compiler warning */
357+
lenlemm;
358358
char *lemm = NULL;
359359
LexizeData ldata;
360360
TSLexeme *norms;
@@ -529,7 +529,7 @@ void
529529
hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query, char *buf, int buflen)
530530
{
531531
int type,
532-
lenlemm = 0; /* silence compiler warning */
532+
lenlemm;
533533
char *lemm = NULL;
534534
LexizeData ldata;
535535
TSLexeme *norms;

src/backend/utils/mb/mbutils.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ pg_do_encoding_conversion(unsigned char *src, int len,
409409
(void) OidFunctionCall6(proc,
410410
Int32GetDatum(src_encoding),
411411
Int32GetDatum(dest_encoding),
412-
CStringGetDatum((char *) src),
413-
CStringGetDatum((char *) result),
412+
CStringGetDatum(src),
413+
CStringGetDatum(result),
414414
Int32GetDatum(len),
415415
BoolGetDatum(false));
416416

@@ -485,8 +485,8 @@ pg_do_encoding_conversion_buf(Oid proc,
485485
result = OidFunctionCall6(proc,
486486
Int32GetDatum(src_encoding),
487487
Int32GetDatum(dest_encoding),
488-
CStringGetDatum((char *) src),
489-
CStringGetDatum((char *) dest),
488+
CStringGetDatum(src),
489+
CStringGetDatum(dest),
490490
Int32GetDatum(srclen),
491491
BoolGetDatum(noError));
492492
return DatumGetInt32(result);
@@ -910,8 +910,8 @@ pg_unicode_to_server(pg_wchar c, unsigned char *s)
910910
FunctionCall6(Utf8ToServerConvProc,
911911
Int32GetDatum(PG_UTF8),
912912
Int32GetDatum(server_encoding),
913-
CStringGetDatum((char *) c_as_utf8),
914-
CStringGetDatum((char *) s),
913+
CStringGetDatum(c_as_utf8),
914+
CStringGetDatum(s),
915915
Int32GetDatum(c_as_utf8_len),
916916
BoolGetDatum(false));
917917
}

src/include/access/gin.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,8 @@ typedef char GinTernaryValue;
6262
#define GIN_MAYBE 2 /* don't know if item is present / don't know
6363
* if matches */
6464

65-
static inline GinTernaryValue
66-
DatumGetGinTernaryValue(Datum X)
67-
{
68-
return (GinTernaryValue) X;
69-
}
70-
71-
static inline Datum
72-
GinTernaryValueGetDatum(GinTernaryValue X)
73-
{
74-
return (Datum) X;
75-
}
76-
65+
#define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
66+
#define GinTernaryValueGetDatum(X) ((Datum)(X))
7767
#define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x)
7868

7969
/* GUC parameters */

src/include/funcapi.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple);
204204
* Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple) - convert a
205205
* HeapTupleHeader to a Datum.
206206
*
207-
* Inline declarations:
207+
* Macro declarations:
208208
* HeapTupleGetDatum(HeapTuple tuple) - convert a HeapTuple to a Datum.
209209
*
210210
* Obsolete routines and macros:
@@ -217,6 +217,10 @@ extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple);
217217
*----------
218218
*/
219219

220+
#define HeapTupleGetDatum(tuple) HeapTupleHeaderGetDatum((tuple)->t_data)
221+
/* obsolete version of above */
222+
#define TupleGetDatum(_slot, _tuple) HeapTupleGetDatum(_tuple)
223+
220224
extern TupleDesc RelationNameGetTupleDesc(const char *relname);
221225
extern TupleDesc TypeGetTupleDesc(Oid typeoid, List *colaliases);
222226

@@ -226,14 +230,6 @@ extern AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc);
226230
extern HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values);
227231
extern Datum HeapTupleHeaderGetDatum(HeapTupleHeader tuple);
228232

229-
static inline Datum
230-
HeapTupleGetDatum(const HeapTupleData *tuple)
231-
{
232-
return HeapTupleHeaderGetDatum(tuple->t_data);
233-
}
234-
/* obsolete version of above */
235-
#define TupleGetDatum(_slot, _tuple) HeapTupleGetDatum(_tuple)
236-
237233

238234
/*----------
239235
* Support for Set Returning Functions (SRFs)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy