mirror of
https://github.com/postgres/postgres.git
synced 2025-10-22 14:32:25 +03:00
Initial pgindent run with pg_bsd_indent version 2.0.
The new indent version includes numerous fixes thanks to Piotr Stefaniak. The main changes visible in this commit are: * Nicer formatting of function-pointer declarations. * No longer unexpectedly removes spaces in expressions using casts, sizeof, or offsetof. * No longer wants to add a space in "struct structname *varname", as well as some similar cases for const- or volatile-qualified pointers. * Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely. * Fixes bug where comments following declarations were sometimes placed with no space separating them from the code. * Fixes some odd decisions for comments following case labels. * Fixes some cases where comments following code were indented to less than the expected column 33. On the less good side, it now tends to put more whitespace around typedef names that are not listed in typedefs.list. This might encourage us to put more effort into typedef name collection; it's not really a bug in indent itself. There are more changes coming after this round, having to do with comment indentation and alignment of lines appearing within parentheses. I wanted to limit the size of the diffs to something that could be reviewed without one's eyes completely glazing over, so it seemed better to split up the changes as much as practical. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
@@ -60,20 +60,20 @@ typedef enum IndexAMProperty
|
||||
|
||||
/* build new index */
|
||||
typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation,
|
||||
Relation indexRelation,
|
||||
struct IndexInfo *indexInfo);
|
||||
Relation indexRelation,
|
||||
struct IndexInfo *indexInfo);
|
||||
|
||||
/* build empty index */
|
||||
typedef void (*ambuildempty_function) (Relation indexRelation);
|
||||
|
||||
/* insert this tuple */
|
||||
typedef bool (*aminsert_function) (Relation indexRelation,
|
||||
Datum *values,
|
||||
bool *isnull,
|
||||
ItemPointer heap_tid,
|
||||
Relation heapRelation,
|
||||
IndexUniqueCheck checkUnique,
|
||||
struct IndexInfo *indexInfo);
|
||||
Datum *values,
|
||||
bool *isnull,
|
||||
ItemPointer heap_tid,
|
||||
Relation heapRelation,
|
||||
IndexUniqueCheck checkUnique,
|
||||
struct IndexInfo *indexInfo);
|
||||
|
||||
/* bulk delete */
|
||||
typedef IndexBulkDeleteResult *(*ambulkdelete_function) (IndexVacuumInfo *info,
|
||||
@@ -90,45 +90,45 @@ typedef bool (*amcanreturn_function) (Relation indexRelation, int attno);
|
||||
|
||||
/* estimate cost of an indexscan */
|
||||
typedef void (*amcostestimate_function) (struct PlannerInfo *root,
|
||||
struct IndexPath *path,
|
||||
double loop_count,
|
||||
Cost *indexStartupCost,
|
||||
Cost *indexTotalCost,
|
||||
Selectivity *indexSelectivity,
|
||||
double *indexCorrelation,
|
||||
double *indexPages);
|
||||
struct IndexPath *path,
|
||||
double loop_count,
|
||||
Cost *indexStartupCost,
|
||||
Cost *indexTotalCost,
|
||||
Selectivity *indexSelectivity,
|
||||
double *indexCorrelation,
|
||||
double *indexPages);
|
||||
|
||||
/* parse index reloptions */
|
||||
typedef bytea *(*amoptions_function) (Datum reloptions,
|
||||
bool validate);
|
||||
bool validate);
|
||||
|
||||
/* report AM, index, or index column property */
|
||||
typedef bool (*amproperty_function) (Oid index_oid, int attno,
|
||||
IndexAMProperty prop, const char *propname,
|
||||
bool *res, bool *isnull);
|
||||
bool *res, bool *isnull);
|
||||
|
||||
/* validate definition of an opclass for this AM */
|
||||
typedef bool (*amvalidate_function) (Oid opclassoid);
|
||||
|
||||
/* prepare for index scan */
|
||||
typedef IndexScanDesc (*ambeginscan_function) (Relation indexRelation,
|
||||
int nkeys,
|
||||
int norderbys);
|
||||
int nkeys,
|
||||
int norderbys);
|
||||
|
||||
/* (re)start index scan */
|
||||
typedef void (*amrescan_function) (IndexScanDesc scan,
|
||||
ScanKey keys,
|
||||
int nkeys,
|
||||
ScanKey orderbys,
|
||||
int norderbys);
|
||||
ScanKey keys,
|
||||
int nkeys,
|
||||
ScanKey orderbys,
|
||||
int norderbys);
|
||||
|
||||
/* next valid tuple */
|
||||
typedef bool (*amgettuple_function) (IndexScanDesc scan,
|
||||
ScanDirection direction);
|
||||
ScanDirection direction);
|
||||
|
||||
/* fetch all valid tuples */
|
||||
typedef int64 (*amgetbitmap_function) (IndexScanDesc scan,
|
||||
TIDBitmap *tbm);
|
||||
TIDBitmap *tbm);
|
||||
|
||||
/* end index scan */
|
||||
typedef void (*amendscan_function) (IndexScanDesc scan);
|
||||
|
@@ -309,7 +309,7 @@ typedef struct GinScanKeyData
|
||||
bool curItemMatches;
|
||||
bool recheckCurItem;
|
||||
bool isFinished;
|
||||
} GinScanKeyData;
|
||||
} GinScanKeyData;
|
||||
|
||||
typedef struct GinScanEntryData
|
||||
{
|
||||
@@ -342,7 +342,7 @@ typedef struct GinScanEntryData
|
||||
bool reduceResult;
|
||||
uint32 predictNumberResult;
|
||||
GinBtreeData btree;
|
||||
} GinScanEntryData;
|
||||
} GinScanEntryData;
|
||||
|
||||
typedef struct GinScanOpaqueData
|
||||
{
|
||||
|
@@ -87,7 +87,7 @@ typedef struct
|
||||
* added, followed by the items themselves as ItemPointers. DELETE actions
|
||||
* have no further data.
|
||||
*/
|
||||
} ginxlogSegmentAction;
|
||||
} ginxlogSegmentAction;
|
||||
|
||||
/* Action types */
|
||||
#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */
|
||||
|
@@ -213,8 +213,8 @@ typedef struct HashMetaPageData
|
||||
uint32 hashm_maxbucket; /* ID of maximum bucket in use */
|
||||
uint32 hashm_highmask; /* mask to modulo into entire table */
|
||||
uint32 hashm_lowmask; /* mask to modulo into lower half of table */
|
||||
uint32 hashm_ovflpoint;/* splitpoint from which ovflpgs being
|
||||
* allocated */
|
||||
uint32 hashm_ovflpoint; /* splitpoint from which ovflpgs being
|
||||
* allocated */
|
||||
uint32 hashm_firstfree; /* lowest-number free ovflpage (bit#) */
|
||||
uint32 hashm_nmaps; /* number of bitmap pages */
|
||||
RegProcedure hashm_procid; /* hash procedure id from pg_proc */
|
||||
|
@@ -63,7 +63,7 @@ typedef struct xl_hash_createidx
|
||||
double num_tuples;
|
||||
RegProcedure procid;
|
||||
uint16 ffactor;
|
||||
} xl_hash_createidx;
|
||||
} xl_hash_createidx;
|
||||
#define SizeOfHashCreateIdx (offsetof(xl_hash_createidx, ffactor) + sizeof(uint16))
|
||||
|
||||
/*
|
||||
|
@@ -32,7 +32,7 @@ typedef struct BulkInsertStateData
|
||||
{
|
||||
BufferAccessStrategy strategy; /* our BULKWRITE strategy object */
|
||||
Buffer current_buf; /* current insertion target page */
|
||||
} BulkInsertStateData;
|
||||
} BulkInsertStateData;
|
||||
|
||||
|
||||
extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
|
||||
|
@@ -55,9 +55,9 @@ typedef IndexTupleData *IndexTuple;
|
||||
typedef struct IndexAttributeBitMapData
|
||||
{
|
||||
bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8];
|
||||
} IndexAttributeBitMapData;
|
||||
} IndexAttributeBitMapData;
|
||||
|
||||
typedef IndexAttributeBitMapData *IndexAttributeBitMap;
|
||||
typedef IndexAttributeBitMapData * IndexAttributeBitMap;
|
||||
|
||||
/*
|
||||
* t_info manipulation macros
|
||||
|
@@ -39,7 +39,7 @@ typedef struct ParallelHeapScanDescData
|
||||
BlockNumber phs_startblock; /* starting block number */
|
||||
BlockNumber phs_cblock; /* current block number */
|
||||
char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER];
|
||||
} ParallelHeapScanDescData;
|
||||
} ParallelHeapScanDescData;
|
||||
|
||||
typedef struct HeapScanDescData
|
||||
{
|
||||
@@ -75,7 +75,7 @@ typedef struct HeapScanDescData
|
||||
int rs_cindex; /* current tuple's index in vistuples */
|
||||
int rs_ntuples; /* number of visible tuples on page */
|
||||
OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */
|
||||
} HeapScanDescData;
|
||||
} HeapScanDescData;
|
||||
|
||||
/*
|
||||
* We use the same IndexScanDescData structure for both amgettuple-based
|
||||
@@ -137,7 +137,7 @@ typedef struct IndexScanDescData
|
||||
|
||||
/* parallel index scan information, in shared memory */
|
||||
ParallelIndexScanDesc parallel_scan;
|
||||
} IndexScanDescData;
|
||||
} IndexScanDescData;
|
||||
|
||||
/* Generic structure for parallel scans */
|
||||
typedef struct ParallelIndexScanDescData
|
||||
@@ -146,7 +146,7 @@ typedef struct ParallelIndexScanDescData
|
||||
Oid ps_indexid;
|
||||
Size ps_offset; /* Offset in bytes of am specific structure */
|
||||
char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER];
|
||||
} ParallelIndexScanDescData;
|
||||
} ParallelIndexScanDescData;
|
||||
|
||||
/* Struct for heap-or-index scans of system tables */
|
||||
typedef struct SysScanDescData
|
||||
@@ -156,6 +156,6 @@ typedef struct SysScanDescData
|
||||
HeapScanDesc scan; /* only valid in heap-scan case */
|
||||
IndexScanDesc iscan; /* only valid in index-scan case */
|
||||
Snapshot snapshot; /* snapshot to unregister at end of scan */
|
||||
} SysScanDescData;
|
||||
} SysScanDescData;
|
||||
|
||||
#endif /* RELSCAN_H */
|
||||
|
@@ -155,7 +155,7 @@ extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage);
|
||||
extern bool SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int pageno);
|
||||
|
||||
typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int segpage,
|
||||
void *data);
|
||||
void *data);
|
||||
extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data);
|
||||
extern void SlruDeleteSegment(SlruCtl ctl, int segno);
|
||||
|
||||
|
@@ -21,24 +21,24 @@
|
||||
*/
|
||||
|
||||
typedef void (*SampleScanGetSampleSize_function) (PlannerInfo *root,
|
||||
RelOptInfo *baserel,
|
||||
List *paramexprs,
|
||||
BlockNumber *pages,
|
||||
double *tuples);
|
||||
RelOptInfo *baserel,
|
||||
List *paramexprs,
|
||||
BlockNumber *pages,
|
||||
double *tuples);
|
||||
|
||||
typedef void (*InitSampleScan_function) (SampleScanState *node,
|
||||
int eflags);
|
||||
int eflags);
|
||||
|
||||
typedef void (*BeginSampleScan_function) (SampleScanState *node,
|
||||
Datum *params,
|
||||
int nparams,
|
||||
uint32 seed);
|
||||
Datum *params,
|
||||
int nparams,
|
||||
uint32 seed);
|
||||
|
||||
typedef BlockNumber (*NextSampleBlock_function) (SampleScanState *node);
|
||||
|
||||
typedef OffsetNumber (*NextSampleTuple_function) (SampleScanState *node,
|
||||
BlockNumber blockno,
|
||||
OffsetNumber maxoffset);
|
||||
BlockNumber blockno,
|
||||
OffsetNumber maxoffset);
|
||||
|
||||
typedef void (*EndSampleScan_function) (SampleScanState *node);
|
||||
|
||||
|
@@ -78,7 +78,7 @@ typedef struct tupleDesc
|
||||
int32 tdtypmod; /* typmod for tuple type */
|
||||
bool tdhasoid; /* tuple has oid attribute in its header */
|
||||
int tdrefcount; /* reference count, or -1 if not counting */
|
||||
} *TupleDesc;
|
||||
} *TupleDesc;
|
||||
|
||||
|
||||
extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
|
||||
|
@@ -152,7 +152,7 @@ extern void toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative);
|
||||
* in compressed format.
|
||||
* ----------
|
||||
*/
|
||||
extern struct varlena *heap_tuple_fetch_attr(struct varlena * attr);
|
||||
extern struct varlena *heap_tuple_fetch_attr(struct varlena *attr);
|
||||
|
||||
/* ----------
|
||||
* heap_tuple_untoast_attr() -
|
||||
@@ -161,7 +161,7 @@ extern struct varlena *heap_tuple_fetch_attr(struct varlena * attr);
|
||||
* it as needed.
|
||||
* ----------
|
||||
*/
|
||||
extern struct varlena *heap_tuple_untoast_attr(struct varlena * attr);
|
||||
extern struct varlena *heap_tuple_untoast_attr(struct varlena *attr);
|
||||
|
||||
/* ----------
|
||||
* heap_tuple_untoast_attr_slice() -
|
||||
@@ -170,7 +170,7 @@ extern struct varlena *heap_tuple_untoast_attr(struct varlena * attr);
|
||||
* (Handles all cases for attribute storage)
|
||||
* ----------
|
||||
*/
|
||||
extern struct varlena *heap_tuple_untoast_attr_slice(struct varlena * attr,
|
||||
extern struct varlena *heap_tuple_untoast_attr_slice(struct varlena *attr,
|
||||
int32 sliceoffset,
|
||||
int32 slicelength);
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#define TWOPHASE_RMGR_H
|
||||
|
||||
typedef void (*TwoPhaseCallback) (TransactionId xid, uint16 info,
|
||||
void *recdata, uint32 len);
|
||||
void *recdata, uint32 len);
|
||||
typedef uint8 TwoPhaseRmgrId;
|
||||
|
||||
/*
|
||||
|
@@ -63,7 +63,7 @@ typedef enum
|
||||
SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */
|
||||
SYNCHRONOUS_COMMIT_REMOTE_APPLY /* wait for local flush and remote
|
||||
* apply */
|
||||
} SyncCommitLevel;
|
||||
} SyncCommitLevel;
|
||||
|
||||
/* Define the default setting for synchronous_commit */
|
||||
#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH
|
||||
@@ -119,7 +119,7 @@ typedef enum
|
||||
} SubXactEvent;
|
||||
|
||||
typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
|
||||
SubTransactionId parentSubid, void *arg);
|
||||
SubTransactionId parentSubid, void *arg);
|
||||
|
||||
|
||||
/* ----------------
|
||||
|
@@ -32,11 +32,11 @@
|
||||
#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized
|
||||
* at replay (implies
|
||||
* NO_IMAGE) */
|
||||
#define REGBUF_STANDARD 0x08/* page follows "standard" page layout, (data
|
||||
* between pd_lower and pd_upper will be
|
||||
* skipped) */
|
||||
#define REGBUF_KEEP_DATA 0x10/* include data even if a full-page image is
|
||||
* taken */
|
||||
#define REGBUF_STANDARD 0x08 /* page follows "standard" page layout,
|
||||
* (data between pd_lower and pd_upper
|
||||
* will be skipped) */
|
||||
#define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image
|
||||
* is taken */
|
||||
|
||||
/* prototypes for public functions in xloginsert.c: */
|
||||
extern void XLogBeginInsert(void);
|
||||
|
@@ -31,11 +31,11 @@ typedef struct XLogReaderState XLogReaderState;
|
||||
|
||||
/* Function type definition for the read_page callback */
|
||||
typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader,
|
||||
XLogRecPtr targetPagePtr,
|
||||
int reqLen,
|
||||
XLogRecPtr targetRecPtr,
|
||||
char *readBuf,
|
||||
TimeLineID *pageTLI);
|
||||
XLogRecPtr targetPagePtr,
|
||||
int reqLen,
|
||||
XLogRecPtr targetRecPtr,
|
||||
char *readBuf,
|
||||
TimeLineID *pageTLI);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@@ -146,7 +146,8 @@ typedef struct XLogRecordBlockImageHeader
|
||||
/* Information stored in bimg_info */
|
||||
#define BKPIMAGE_HAS_HOLE 0x01 /* page image has "hole" */
|
||||
#define BKPIMAGE_IS_COMPRESSED 0x02 /* page image is compressed */
|
||||
#define BKPIMAGE_APPLY 0x04 /* page image should be restored during replay */
|
||||
#define BKPIMAGE_APPLY 0x04 /* page image should be restored during
|
||||
* replay */
|
||||
|
||||
/*
|
||||
* Extra header information used when page image has "hole" and
|
||||
@@ -195,7 +196,7 @@ typedef struct XLogRecordDataHeaderShort
|
||||
{
|
||||
uint8 id; /* XLR_BLOCK_ID_DATA_SHORT */
|
||||
uint8 data_length; /* number of payload bytes */
|
||||
} XLogRecordDataHeaderShort;
|
||||
} XLogRecordDataHeaderShort;
|
||||
|
||||
#define SizeOfXLogRecordDataHeaderShort (sizeof(uint8) * 2)
|
||||
|
||||
@@ -203,7 +204,7 @@ typedef struct XLogRecordDataHeaderLong
|
||||
{
|
||||
uint8 id; /* XLR_BLOCK_ID_DATA_LONG */
|
||||
/* followed by uint32 data_length, unaligned */
|
||||
} XLogRecordDataHeaderLong;
|
||||
} XLogRecordDataHeaderLong;
|
||||
|
||||
#define SizeOfXLogRecordDataHeaderLong (sizeof(uint8) + sizeof(uint32))
|
||||
|
||||
|
Reference in New Issue
Block a user