1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-18 04:29:09 +03:00

Change fmgr.h typedefs to use original names

fmgr.h defined some types such as fmNodePtr which is just Node *, but
it made its own types to avoid having to include various header files.
With C11, we can now instead typedef the original names without fear
of conflicts.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org
This commit is contained in:
Peter Eisentraut
2025-09-15 10:48:30 +02:00
parent dc41d7415f
commit 4bd9191298
4 changed files with 18 additions and 23 deletions

View File

@@ -1570,7 +1570,6 @@ InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
* This is basically like InputFunctionCall, but the converted Datum is
* returned into *result while the function result is true for success or
* false for failure. Also, the caller may pass an ErrorSaveContext node.
* (We declare that as "fmNodePtr" to avoid including nodes.h in fmgr.h.)
*
* If escontext points to an ErrorSaveContext, any "soft" errors detected by
* the input function will be reported by filling the escontext struct and
@@ -1584,7 +1583,7 @@ InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
bool
InputFunctionCallSafe(FmgrInfo *flinfo, char *str,
Oid typioparam, int32 typmod,
fmNodePtr escontext,
Node *escontext,
Datum *result)
{
LOCAL_FCINFO(fcinfo, 3);
@@ -1639,7 +1638,7 @@ InputFunctionCallSafe(FmgrInfo *flinfo, char *str,
bool
DirectInputFunctionCallSafe(PGFunction func, char *str,
Oid typioparam, int32 typmod,
fmNodePtr escontext,
Node *escontext,
Datum *result)
{
LOCAL_FCINFO(fcinfo, 3);

View File

@@ -19,14 +19,14 @@
#define FMGR_H
/* We don't want to include primnodes.h here, so make some stub references */
typedef struct Node *fmNodePtr;
typedef struct Aggref *fmAggrefPtr;
typedef struct Node Node;
typedef struct Aggref Aggref;
/* Likewise, avoid including execnodes.h here */
typedef void (*fmExprContextCallbackFunction) (Datum arg);
typedef void (*ExprContextCallbackFunction) (Datum arg);
/* Likewise, avoid including stringinfo.h here */
typedef struct StringInfoData *fmStringInfo;
typedef struct StringInfoData *StringInfo;
/*
@@ -63,7 +63,7 @@ typedef struct FmgrInfo
unsigned char fn_stats; /* collect stats if track_functions > this */
void *fn_extra; /* extra space for use by handler */
MemoryContext fn_mcxt; /* memory context to store fn_extra in */
fmNodePtr fn_expr; /* expression parse tree for call, or NULL */
Node *fn_expr; /* expression parse tree for call, or NULL */
} FmgrInfo;
/*
@@ -85,8 +85,8 @@ typedef struct FmgrInfo
typedef struct FunctionCallInfoBaseData
{
FmgrInfo *flinfo; /* ptr to lookup info used for this call */
fmNodePtr context; /* pass info about context of call */
fmNodePtr resultinfo; /* pass or return extra info about result */
Node *context; /* pass info about context of call */
Node *resultinfo; /* pass or return extra info about result */
Oid fncollation; /* collation for function to use */
#define FIELDNO_FUNCTIONCALLINFODATA_ISNULL 4
bool isnull; /* function must set true if result is NULL */
@@ -742,19 +742,19 @@ extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str,
Oid typioparam, int32 typmod);
extern bool InputFunctionCallSafe(FmgrInfo *flinfo, char *str,
Oid typioparam, int32 typmod,
fmNodePtr escontext,
Node *escontext,
Datum *result);
extern bool DirectInputFunctionCallSafe(PGFunction func, char *str,
Oid typioparam, int32 typmod,
fmNodePtr escontext,
Node *escontext,
Datum *result);
extern Datum OidInputFunctionCall(Oid functionId, char *str,
Oid typioparam, int32 typmod);
extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val);
extern char *OidOutputFunctionCall(Oid functionId, Datum val);
extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf,
extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, StringInfo buf,
Oid typioparam, int32 typmod);
extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf,
extern Datum OidReceiveFunctionCall(Oid functionId, StringInfo buf,
Oid typioparam, int32 typmod);
extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val);
extern bytea *OidSendFunctionCall(Oid functionId, Datum val);
@@ -767,9 +767,9 @@ extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, const char *f
extern Oid fmgr_internal_function(const char *proname);
extern Oid get_fn_expr_rettype(FmgrInfo *flinfo);
extern Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum);
extern Oid get_call_expr_argtype(fmNodePtr expr, int argnum);
extern Oid get_call_expr_argtype(Node *expr, int argnum);
extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum);
extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum);
extern bool get_call_expr_arg_stable(Node *expr, int argnum);
extern bool get_fn_expr_variadic(FmgrInfo *flinfo);
extern bytea *get_fn_opclass_options(FmgrInfo *flinfo);
extern bool has_fn_opclass_options(FmgrInfo *flinfo);
@@ -814,11 +814,11 @@ extern void RestoreLibraryState(char *start_address);
extern int AggCheckCallContext(FunctionCallInfo fcinfo,
MemoryContext *aggcontext);
extern fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo);
extern Aggref *AggGetAggref(FunctionCallInfo fcinfo);
extern MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo);
extern bool AggStateIsShared(FunctionCallInfo fcinfo);
extern void AggRegisterCallback(FunctionCallInfo fcinfo,
fmExprContextCallbackFunction func,
ExprContextCallbackFunction func,
Datum arg);
/*

View File

@@ -80,7 +80,7 @@ extern PGDLLIMPORT bool quote_all_identifiers;
extern const char *quote_identifier(const char *ident);
extern char *quote_qualified_identifier(const char *qualifier,
const char *ident);
extern void generate_operator_clause(fmStringInfo buf,
extern void generate_operator_clause(StringInfo buf,
const char *leftop, Oid leftoptype,
Oid opoid,
const char *rightop, Oid rightoptype);

View File

@@ -3635,10 +3635,6 @@ float8
float8KEY
floating_decimal_32
floating_decimal_64
fmAggrefPtr
fmExprContextCallbackFunction
fmNodePtr
fmStringInfo
fmgr_hook_type
foreign_glob_cxt
foreign_loc_cxt