From a6818deded7ab8c1e8a97bdcdd88c95d107e5c11 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 13 Jan 2019 20:35:39 -0800
Subject: [PATCH v2 2/3] Make naming of tupdesc related structs more consistent
 with the rest of PG.

We usually don't change the name of structs between the struct name
itself, and the name of the typedef.

Author:
Reviewed-By:
Discussion: https://postgr.es/m/
Backpatch:
---
 src/backend/access/common/tupdesc.c  |  2 +-
 src/backend/jit/llvm/llvmjit.c       |  4 ++--
 src/backend/jit/llvm/llvmjit_types.c |  2 +-
 src/include/access/tupdesc.h         | 15 ++++++++-------
 src/include/access/tupdesc_details.h |  2 +-
 src/include/jit/llvmjit.h            |  2 +-
 6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index e98abadcd7f..47e80ae1860 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -63,7 +63,7 @@ CreateTemplateTupleDesc(int natts)
 	 * could be less due to trailing padding, although with the current
 	 * definition of pg_attribute there probably isn't any padding.
 	 */
-	desc = (TupleDesc) palloc(offsetof(struct tupleDesc, attrs) +
+	desc = (TupleDesc) palloc(offsetof(struct TupleDescData, attrs) +
 							  natts * sizeof(FormData_pg_attribute));
 
 	/*
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index 03663353b37..6b9aaf49c68 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -63,7 +63,7 @@ LLVMTypeRef StructItemPointerData;
 LLVMTypeRef StructBlockId;
 LLVMTypeRef StructFormPgAttribute;
 LLVMTypeRef StructTupleConstr;
-LLVMTypeRef StructtupleDesc;
+LLVMTypeRef StructTupleDescData;
 LLVMTypeRef StructTupleTableSlot;
 LLVMTypeRef StructHeapTupleTableSlot;
 LLVMTypeRef StructMinimalTupleTableSlot;
@@ -816,7 +816,7 @@ llvm_create_types(void)
 	StructHeapTupleTableSlot = load_type(mod, "StructHeapTupleTableSlot");
 	StructMinimalTupleTableSlot = load_type(mod, "StructMinimalTupleTableSlot");
 	StructHeapTupleData = load_type(mod, "StructHeapTupleData");
-	StructtupleDesc = load_type(mod, "StructtupleDesc");
+	StructTupleDescData = load_type(mod, "StructTupleDescData");
 	StructAggState = load_type(mod, "StructAggState");
 	StructAggStatePerGroupData = load_type(mod, "StructAggStatePerGroupData");
 	StructAggStatePerTransData = load_type(mod, "StructAggStatePerTransData");
diff --git a/src/backend/jit/llvm/llvmjit_types.c b/src/backend/jit/llvm/llvmjit_types.c
index 51cc3cbcb18..79949829721 100644
--- a/src/backend/jit/llvm/llvmjit_types.c
+++ b/src/backend/jit/llvm/llvmjit_types.c
@@ -61,7 +61,7 @@ MemoryContextData StructMemoryContextData;
 TupleTableSlot StructTupleTableSlot;
 HeapTupleTableSlot StructHeapTupleTableSlot;
 MinimalTupleTableSlot StructMinimalTupleTableSlot;
-struct tupleDesc StructtupleDesc;
+TupleDescData StructTupleDescData;
 
 
 /*
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h
index d88bdcec847..a1f45792f51 100644
--- a/src/include/access/tupdesc.h
+++ b/src/include/access/tupdesc.h
@@ -19,15 +19,15 @@
 #include "nodes/pg_list.h"
 
 
-typedef struct attrDefault
+typedef struct AttrDefault
 {
 	AttrNumber	adnum;
 	char	   *adbin;			/* nodeToString representation of expr */
 } AttrDefault;
 
-typedef struct attrMissing *MissingPtr;
+typedef struct AttrMissing *MissingPtr;
 
-typedef struct constrCheck
+typedef struct ConstrCheck
 {
 	char	   *ccname;
 	char	   *ccbin;			/* nodeToString representation of expr */
@@ -36,7 +36,7 @@ typedef struct constrCheck
 } ConstrCheck;
 
 /* This structure contains constraints of a tuple */
-typedef struct tupleConstr
+typedef struct TupleConstr
 {
 	AttrDefault *defval;		/* array */
 	ConstrCheck *check;			/* array */
@@ -77,7 +77,7 @@ typedef struct tupleConstr
  * field of such a descriptor to -1, while reference-counted descriptors
  * always have tdrefcount >= 0.
  */
-typedef struct tupleDesc
+typedef struct TupleDescData
 {
 	int			natts;			/* number of attributes in the tuple */
 	Oid			tdtypeid;		/* composite type ID for tuple type */
@@ -86,7 +86,8 @@ typedef struct tupleDesc
 	TupleConstr *constr;		/* constraints, or NULL if none */
 	/* attrs[N] is the description of Attribute Number N+1 */
 	FormData_pg_attribute attrs[FLEXIBLE_ARRAY_MEMBER];
-}		   *TupleDesc;
+} TupleDescData;
+typedef struct TupleDescData *TupleDesc;
 
 /* Accessor for the i'th attribute of tupdesc. */
 #define TupleDescAttr(tupdesc, i) (&(tupdesc)->attrs[(i)])
@@ -100,7 +101,7 @@ extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
 extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc);
 
 #define TupleDescSize(src) \
-	(offsetof(struct tupleDesc, attrs) + \
+	(offsetof(struct TupleDescData, attrs) + \
 	 (src)->natts * sizeof(FormData_pg_attribute))
 
 extern void TupleDescCopy(TupleDesc dst, TupleDesc src);
diff --git a/src/include/access/tupdesc_details.h b/src/include/access/tupdesc_details.h
index 39c0320a818..a0b2be100f3 100644
--- a/src/include/access/tupdesc_details.h
+++ b/src/include/access/tupdesc_details.h
@@ -19,7 +19,7 @@
  * Structure used to represent value to be used when the attribute is not
  * present at all in a tuple, i.e. when the column was created after the tuple
  */
-typedef struct attrMissing
+typedef struct AttrMissing
 {
 	bool		am_present;		/* true if non-NULL missing value exists */
 	Datum		am_value;		/* value when attribute is missing */
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h
index 91829bc441c..2545abeddd1 100644
--- a/src/include/jit/llvmjit.h
+++ b/src/include/jit/llvmjit.h
@@ -62,7 +62,7 @@ extern LLVMTypeRef TypePGFunction;
 extern LLVMTypeRef TypeSizeT;
 extern LLVMTypeRef TypeStorageBool;
 
-extern LLVMTypeRef StructtupleDesc;
+extern LLVMTypeRef StructTupleDescData;
 extern LLVMTypeRef StructHeapTupleData;
 extern LLVMTypeRef StructTupleTableSlot;
 extern LLVMTypeRef StructHeapTupleTableSlot;
-- 
2.18.0.rc2.dirty

