]> granicus.if.org Git - postgresql/commitdiff
Make naming of tupdesc related structs more consistent with the rest of PG.
authorAndres Freund <andres@anarazel.de>
Tue, 15 Jan 2019 00:15:20 +0000 (16:15 -0800)
committerAndres Freund <andres@anarazel.de>
Tue, 15 Jan 2019 00:25:50 +0000 (16:25 -0800)
We usually don't change the name of structs between the struct name
itself and the name of the typedef. Additionally, structs that are
usually used via a typedef that hides being a pointer, are commonly
suffixed Data.  Change tupdesc code to follow those convention.

This is triggered by a future patch that intends to forward declare
TupleDescData in another header - keeping with the naming scheme makes
that easier to understand.

Author: Andres Freund
Discussion: https://postgr.es/m/20190114000701.y4ttcb74jpskkcfb@alap3.anarazel.de

src/backend/access/common/tupdesc.c
src/backend/jit/llvm/llvmjit.c
src/backend/jit/llvm/llvmjit_types.c
src/include/access/tupdesc.h
src/include/access/tupdesc_details.h
src/include/jit/llvmjit.h

index e98abadcd7fe796011bc803ec2a1c619549f63a6..47e80ae1860dee2a6bf55d6f8f9511140d71d003 100644 (file)
@@ -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));
 
        /*
index 03663353b379c442926b578968e634ed1854e8e4..6b9aaf49c68fc91eddde848db0e7f333c30b325e 100644 (file)
@@ -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");
index 51cc3cbcb1837c6f64b98db3008f4d98acbd7a46..7994982972180c854ddacbd9f19e3be1ca78867e 100644 (file)
@@ -61,7 +61,7 @@ MemoryContextData StructMemoryContextData;
 TupleTableSlot StructTupleTableSlot;
 HeapTupleTableSlot StructHeapTupleTableSlot;
 MinimalTupleTableSlot StructMinimalTupleTableSlot;
-struct tupleDesc StructtupleDesc;
+TupleDescData StructTupleDescData;
 
 
 /*
index 93546ce585b84c138d84abf65aa1a052c72d9d5e..66d1b2fc40ed3c50b7d236f770f628e3bd01bfd0 100644 (file)
 #include "nodes/pg_list.h"
 
 
-typedef struct attrDefault
+typedef struct AttrDefault
 {
        AttrNumber      adnum;
        char       *adbin;                      /* nodeToString representation of expr */
 } AttrDefault;
 
-typedef struct constrCheck
+typedef struct ConstrCheck
 {
        char       *ccname;
        char       *ccbin;                      /* nodeToString representation of expr */
@@ -34,11 +34,11 @@ typedef struct constrCheck
 } ConstrCheck;
 
 /* This structure contains constraints of a tuple */
-typedef struct tupleConstr
+typedef struct TupleConstr
 {
        AttrDefault *defval;            /* array */
        ConstrCheck *check;                     /* array */
-       struct attrMissing *missing;            /* missing attributes values, NULL if none */
+       struct AttrMissing *missing;            /* missing attributes values, NULL if none */
        uint16          num_defval;
        uint16          num_check;
        bool            has_not_null;
@@ -75,7 +75,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 */
@@ -84,7 +84,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)])
@@ -98,7 +99,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);
index 39c0320a818249f855895b11be4a19fd595f07fd..a0b2be100f34c54bffbb097c4eed198f419d0bec 100644 (file)
@@ -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 */
index 91829bc441ce328e6058f19030b13f684b807731..2545abeddd18176f99d0fc2e20da2d542b5054a9 100644 (file)
@@ -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;