From 275411912d96c160547a219cb3223efa3737f90d Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon, 27 Dec 2010 11:26:19 -0500
Subject: [PATCH] Fix ill-chosen use of "private" as an argument and struct
 field name.

"private" is a keyword in C++, so this breaks the poorly-enforced policy
that header files should be include-able in C++ code.  Per report from
Craig Ringer and some investigation with cpluspluscheck.
---
 src/backend/utils/fmgr/fmgr.c | 8 ++++----
 src/include/fmgr.h            | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index e457af97647..a14d9ba8c0b 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -863,7 +863,7 @@ struct fmgr_security_definer_cache
 	FmgrInfo	flinfo;			/* lookup info for target function */
 	Oid			userid;			/* userid to set, or InvalidOid */
 	ArrayType  *proconfig;		/* GUC values to set, or NULL */
-	Datum		private;		/* private usage for plugin modules */
+	Datum		arg;			/* passthrough argument for plugin modules */
 };
 
 /*
@@ -949,7 +949,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
 
 	/* function manager hook */
 	if (fmgr_hook)
-		(*fmgr_hook)(FHET_START, &fcache->flinfo, &fcache->private);
+		(*fmgr_hook)(FHET_START, &fcache->flinfo, &fcache->arg);
 
 	/*
 	 * We don't need to restore GUC or userid settings on error, because the
@@ -980,7 +980,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
 	{
 		fcinfo->flinfo = save_flinfo;
 		if (fmgr_hook)
-			(*fmgr_hook)(FHET_ABORT, &fcache->flinfo, &fcache->private);
+			(*fmgr_hook)(FHET_ABORT, &fcache->flinfo, &fcache->arg);
 		PG_RE_THROW();
 	}
 	PG_END_TRY();
@@ -992,7 +992,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
 	if (OidIsValid(fcache->userid))
 		SetUserIdAndSecContext(save_userid, save_sec_context);
 	if (fmgr_hook)
-		(*fmgr_hook)(FHET_END, &fcache->flinfo, &fcache->private);
+		(*fmgr_hook)(FHET_END, &fcache->flinfo, &fcache->arg);
 
 	return result;
 }
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 99213bc1179..2813b29af5f 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -563,7 +563,7 @@ typedef enum FmgrHookEventType
 typedef bool (*needs_fmgr_hook_type)(Oid fn_oid);
 
 typedef void (*fmgr_hook_type)(FmgrHookEventType event,
-							   FmgrInfo *flinfo, Datum *private);
+							   FmgrInfo *flinfo, Datum *arg);
 
 extern PGDLLIMPORT needs_fmgr_hook_type	needs_fmgr_hook;
 extern PGDLLIMPORT fmgr_hook_type		fmgr_hook;
-- 
GitLab