]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Change fmgr.h typedefs to use original names
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 15 Sep 2025 08:48:30 +0000 (10:48 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 15 Sep 2025 09:04:10 +0000 (11:04 +0200)
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

src/backend/utils/fmgr/fmgr.c
src/include/fmgr.h
src/include/utils/builtins.h
src/tools/pgindent/typedefs.list

index 5543440a33e6c8ba65ee234bbda8eee0315b887a..b4c1e2c4b21b238a708181f48d8271b24c3086c4 100644 (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);
index c7236e4297242c26c6b8d6e9358c8cb554c1a2c4..74fe3ea05758accba593940adf8ce8e0e328c28a 100644 (file)
 #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);
 
 /*
index 1c98c7d2255ce4345b7207e19258c45b9b8e7ec8..ce6285a2c0376ee2a7bfe6e1f5ba2151f248c996 100644 (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);
index 9db8e2424c03884d3ad69bd280622dddc8e7a3a9..e90af5b2ad364a1609ff905d3bb43dd10b677573 100644 (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