diff options
author | Álvaro Herrera <alvherre@kurilemu.de> | 2025-09-25 14:33:19 +0200 |
---|---|---|
committer | Álvaro Herrera <alvherre@kurilemu.de> | 2025-09-25 14:33:19 +0200 |
commit | 81fc3e28e383d9a21843a5ab845a1bd1a1042e12 (patch) | |
tree | 6681c73308059f9901abadb020136b7b94b56ead /src | |
parent | 668de0430942829cc6085ab6ee99fd8080d21f0a (diff) |
Update some more forward declarations to use typedef
As commit d4d1fc527bdb.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/202509191025.22agk3fvpilc@alvherre.pgsql
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/table/tableam.c | 2 | ||||
-rw-r--r-- | src/include/access/amapi.h | 16 | ||||
-rw-r--r-- | src/include/access/brin_internal.h | 6 | ||||
-rw-r--r-- | src/include/access/genam.h | 13 | ||||
-rw-r--r-- | src/include/access/heapam.h | 18 | ||||
-rw-r--r-- | src/include/access/tableam.h | 62 | ||||
-rw-r--r-- | src/include/nodes/execnodes.h | 14 |
7 files changed, 66 insertions, 65 deletions
diff --git a/src/backend/access/table/tableam.c b/src/backend/access/table/tableam.c index a56c5eceb14..5e41404937e 100644 --- a/src/backend/access/table/tableam.c +++ b/src/backend/access/table/tableam.c @@ -110,7 +110,7 @@ table_slot_create(Relation relation, List **reglist) */ TableScanDesc -table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key) +table_beginscan_catalog(Relation relation, int nkeys, ScanKeyData *key) { uint32 flags = SO_TYPE_SEQSCAN | SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE | SO_TEMP_SNAPSHOT; diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h index 70949de56ac..2b4482dc1e6 100644 --- a/src/include/access/amapi.h +++ b/src/include/access/amapi.h @@ -21,11 +21,11 @@ * AM's implementation isn't concerned with those data structures. To allow * declaring amcostestimate_function here, use forward struct references. */ -struct PlannerInfo; -struct IndexPath; +typedef struct PlannerInfo PlannerInfo; +typedef struct IndexPath IndexPath; /* Likewise, this file shouldn't depend on execnodes.h. */ -struct IndexInfo; +typedef struct IndexInfo IndexInfo; /* @@ -110,7 +110,7 @@ typedef StrategyNumber (*amtranslate_cmptype_function) (CompareType cmptype, Oid /* build new index */ typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation, Relation indexRelation, - struct IndexInfo *indexInfo); + IndexInfo *indexInfo); /* build empty index */ typedef void (*ambuildempty_function) (Relation indexRelation); @@ -123,11 +123,11 @@ typedef bool (*aminsert_function) (Relation indexRelation, Relation heapRelation, IndexUniqueCheck checkUnique, bool indexUnchanged, - struct IndexInfo *indexInfo); + IndexInfo *indexInfo); /* cleanup after insert */ typedef void (*aminsertcleanup_function) (Relation indexRelation, - struct IndexInfo *indexInfo); + IndexInfo *indexInfo); /* bulk delete */ typedef IndexBulkDeleteResult *(*ambulkdelete_function) (IndexVacuumInfo *info, @@ -143,8 +143,8 @@ typedef IndexBulkDeleteResult *(*amvacuumcleanup_function) (IndexVacuumInfo *inf typedef bool (*amcanreturn_function) (Relation indexRelation, int attno); /* estimate cost of an indexscan */ -typedef void (*amcostestimate_function) (struct PlannerInfo *root, - struct IndexPath *path, +typedef void (*amcostestimate_function) (PlannerInfo *root, + IndexPath *path, double loop_count, Cost *indexStartupCost, Cost *indexTotalCost, diff --git a/src/include/access/brin_internal.h b/src/include/access/brin_internal.h index d093a0bf130..452c646a088 100644 --- a/src/include/access/brin_internal.h +++ b/src/include/access/brin_internal.h @@ -89,14 +89,14 @@ typedef struct BrinDesc extern BrinDesc *brin_build_desc(Relation rel); extern void brin_free_desc(BrinDesc *bdesc); extern IndexBuildResult *brinbuild(Relation heap, Relation index, - struct IndexInfo *indexInfo); + IndexInfo *indexInfo); extern void brinbuildempty(Relation index); extern bool brininsert(Relation idxRel, Datum *values, bool *nulls, ItemPointer heaptid, Relation heapRel, IndexUniqueCheck checkUnique, bool indexUnchanged, - struct IndexInfo *indexInfo); -extern void brininsertcleanup(Relation index, struct IndexInfo *indexInfo); + IndexInfo *indexInfo); +extern void brininsertcleanup(Relation index, IndexInfo *indexInfo); extern IndexScanDesc brinbeginscan(Relation r, int nkeys, int norderbys); extern int64 bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm); extern void brinrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 0831c33b038..ac62f6a6abd 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -24,7 +24,9 @@ #include "utils/snapshot.h" /* We don't want this file to depend on execnodes.h. */ -struct IndexInfo; +typedef struct IndexInfo IndexInfo; +typedef struct TupleTableSlot TupleTableSlot; + /* * Struct for statistics maintained by amgettuple and amgetbitmap @@ -165,9 +167,9 @@ extern bool index_insert(Relation indexRelation, Relation heapRelation, IndexUniqueCheck checkUnique, bool indexUnchanged, - struct IndexInfo *indexInfo); + IndexInfo *indexInfo); extern void index_insert_cleanup(Relation indexRelation, - struct IndexInfo *indexInfo); + IndexInfo *indexInfo); extern IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, @@ -202,10 +204,9 @@ extern IndexScanDesc index_beginscan_parallel(Relation heaprel, ParallelIndexScanDesc pscan); extern ItemPointer index_getnext_tid(IndexScanDesc scan, ScanDirection direction); -struct TupleTableSlot; -extern bool index_fetch_heap(IndexScanDesc scan, struct TupleTableSlot *slot); +extern bool index_fetch_heap(IndexScanDesc scan, TupleTableSlot *slot); extern bool index_getnext_slot(IndexScanDesc scan, ScanDirection direction, - struct TupleTableSlot *slot); + TupleTableSlot *slot); extern int64 index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap); extern IndexBulkDeleteResult *index_bulk_delete(IndexVacuumInfo *info, diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index a1de400b9a5..e60d34dad25 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -44,7 +44,8 @@ #define HEAP_PAGE_PRUNE_FREEZE (1 << 1) typedef struct BulkInsertStateData *BulkInsertState; -struct TupleTableSlot; +typedef struct GlobalVisState GlobalVisState; +typedef struct TupleTableSlot TupleTableSlot; struct VacuumCutoffs; #define MaxLockTupleMode LockTupleExclusive @@ -292,7 +293,7 @@ extern void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params, extern void heap_endscan(TableScanDesc sscan); extern HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction); extern bool heap_getnextslot(TableScanDesc sscan, - ScanDirection direction, struct TupleTableSlot *slot); + ScanDirection direction, TupleTableSlot *slot); extern void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid); extern bool heap_getnextslot_tidrange(TableScanDesc sscan, @@ -312,23 +313,23 @@ extern void ReleaseBulkInsertStatePin(BulkInsertState bistate); extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate); -extern void heap_multi_insert(Relation relation, struct TupleTableSlot **slots, +extern void heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples, CommandId cid, int options, BulkInsertState bistate); extern TM_Result heap_delete(Relation relation, ItemPointer tid, CommandId cid, Snapshot crosscheck, bool wait, - struct TM_FailureData *tmfd, bool changingPart); + TM_FailureData *tmfd, bool changingPart); extern void heap_finish_speculative(Relation relation, ItemPointer tid); extern void heap_abort_speculative(Relation relation, ItemPointer tid); extern TM_Result heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, CommandId cid, Snapshot crosscheck, bool wait, - struct TM_FailureData *tmfd, LockTupleMode *lockmode, + TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes); extern TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, bool follow_updates, - Buffer *buffer, struct TM_FailureData *tmfd); + Buffer *buffer, TM_FailureData *tmfd); extern bool heap_inplace_lock(Relation relation, HeapTuple oldtup_ptr, Buffer buffer, @@ -365,10 +366,9 @@ extern TransactionId heap_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate); /* in heap/pruneheap.c */ -struct GlobalVisState; extern void heap_page_prune_opt(Relation relation, Buffer buffer); extern void heap_page_prune_and_freeze(Relation relation, Buffer buffer, - struct GlobalVisState *vistest, + GlobalVisState *vistest, int options, struct VacuumCutoffs *cutoffs, PruneFreezeResult *presult, @@ -407,7 +407,7 @@ extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, uint16 infomask, TransactionId xid); extern bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple); extern bool HeapTupleIsSurelyDead(HeapTuple htup, - struct GlobalVisState *vistest); + GlobalVisState *vistest); /* * To avoid leaking too much knowledge about reorderbuffer implementation diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h index 77eb41eb6dc..e16bf025692 100644 --- a/src/include/access/tableam.h +++ b/src/include/access/tableam.h @@ -34,10 +34,11 @@ extern PGDLLIMPORT char *default_table_access_method; extern PGDLLIMPORT bool synchronize_seqscans; -struct BulkInsertStateData; -struct IndexInfo; -struct SampleScanState; -struct ValidateIndexState; +/* forward references in this file */ +typedef struct BulkInsertStateData BulkInsertStateData; +typedef struct IndexInfo IndexInfo; +typedef struct SampleScanState SampleScanState; +typedef struct ValidateIndexState ValidateIndexState; /* * Bitmask values for the flags argument to the scan_begin callback. @@ -325,7 +326,7 @@ typedef struct TableAmRoutine */ TableScanDesc (*scan_begin) (Relation rel, Snapshot snapshot, - int nkeys, struct ScanKeyData *key, + int nkeys, ScanKeyData *key, ParallelTableScanDesc pscan, uint32 flags); @@ -339,7 +340,7 @@ typedef struct TableAmRoutine * Restart relation scan. If set_params is set to true, allow_{strat, * sync, pagemode} (see scan_begin) changes should be taken into account. */ - void (*scan_rescan) (TableScanDesc scan, struct ScanKeyData *key, + void (*scan_rescan) (TableScanDesc scan, ScanKeyData *key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode); @@ -508,14 +509,14 @@ typedef struct TableAmRoutine /* see table_tuple_insert() for reference about parameters */ void (*tuple_insert) (Relation rel, TupleTableSlot *slot, CommandId cid, int options, - struct BulkInsertStateData *bistate); + BulkInsertStateData *bistate); /* see table_tuple_insert_speculative() for reference about parameters */ void (*tuple_insert_speculative) (Relation rel, TupleTableSlot *slot, CommandId cid, int options, - struct BulkInsertStateData *bistate, + BulkInsertStateData *bistate, uint32 specToken); /* see table_tuple_complete_speculative() for reference about parameters */ @@ -526,7 +527,7 @@ typedef struct TableAmRoutine /* see table_multi_insert() for reference about parameters */ void (*multi_insert) (Relation rel, TupleTableSlot **slots, int nslots, - CommandId cid, int options, struct BulkInsertStateData *bistate); + CommandId cid, int options, BulkInsertStateData *bistate); /* see table_tuple_delete() for reference about parameters */ TM_Result (*tuple_delete) (Relation rel, @@ -690,7 +691,7 @@ typedef struct TableAmRoutine /* see table_index_build_range_scan for reference about parameters */ double (*index_build_range_scan) (Relation table_rel, Relation index_rel, - struct IndexInfo *index_info, + IndexInfo *index_info, bool allow_sync, bool anyvisible, bool progress, @@ -703,9 +704,9 @@ typedef struct TableAmRoutine /* see table_index_validate_scan for reference about parameters */ void (*index_validate_scan) (Relation table_rel, Relation index_rel, - struct IndexInfo *index_info, + IndexInfo *index_info, Snapshot snapshot, - struct ValidateIndexState *state); + ValidateIndexState *state); /* ------------------------------------------------------------------------ @@ -821,7 +822,7 @@ typedef struct TableAmRoutine * scans. If infeasible to implement, the AM may raise an error. */ bool (*scan_sample_next_block) (TableScanDesc scan, - struct SampleScanState *scanstate); + SampleScanState *scanstate); /* * This callback, only called after scan_sample_next_block has returned @@ -837,7 +838,7 @@ typedef struct TableAmRoutine * assumption somehow. */ bool (*scan_sample_next_tuple) (TableScanDesc scan, - struct SampleScanState *scanstate, + SampleScanState *scanstate, TupleTableSlot *slot); } TableAmRoutine; @@ -873,7 +874,7 @@ extern TupleTableSlot *table_slot_create(Relation relation, List **reglist); */ static inline TableScanDesc table_beginscan(Relation rel, Snapshot snapshot, - int nkeys, struct ScanKeyData *key) + int nkeys, ScanKeyData *key) { uint32 flags = SO_TYPE_SEQSCAN | SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE; @@ -886,7 +887,7 @@ table_beginscan(Relation rel, Snapshot snapshot, * snapshot appropriate for scanning catalog relations. */ extern TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, - struct ScanKeyData *key); + ScanKeyData *key); /* * Like table_beginscan(), but table_beginscan_strat() offers an extended API @@ -897,7 +898,7 @@ extern TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, */ static inline TableScanDesc table_beginscan_strat(Relation rel, Snapshot snapshot, - int nkeys, struct ScanKeyData *key, + int nkeys, ScanKeyData *key, bool allow_strat, bool allow_sync) { uint32 flags = SO_TYPE_SEQSCAN | SO_ALLOW_PAGEMODE; @@ -918,7 +919,7 @@ table_beginscan_strat(Relation rel, Snapshot snapshot, */ static inline TableScanDesc table_beginscan_bm(Relation rel, Snapshot snapshot, - int nkeys, struct ScanKeyData *key) + int nkeys, ScanKeyData *key) { uint32 flags = SO_TYPE_BITMAPSCAN | SO_ALLOW_PAGEMODE; @@ -935,7 +936,7 @@ table_beginscan_bm(Relation rel, Snapshot snapshot, */ static inline TableScanDesc table_beginscan_sampling(Relation rel, Snapshot snapshot, - int nkeys, struct ScanKeyData *key, + int nkeys, ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode) { @@ -990,8 +991,7 @@ table_endscan(TableScanDesc scan) * Restart a relation scan. */ static inline void -table_rescan(TableScanDesc scan, - struct ScanKeyData *key) +table_rescan(TableScanDesc scan, ScanKeyData *key) { scan->rs_rd->rd_tableam->scan_rescan(scan, key, false, false, false, false); } @@ -1005,7 +1005,7 @@ table_rescan(TableScanDesc scan, * previously selected startblock will be kept. */ static inline void -table_rescan_set_params(TableScanDesc scan, struct ScanKeyData *key, +table_rescan_set_params(TableScanDesc scan, ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode) { scan->rs_rd->rd_tableam->scan_rescan(scan, key, true, @@ -1365,7 +1365,7 @@ table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate) */ static inline void table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, - int options, struct BulkInsertStateData *bistate) + int options, BulkInsertStateData *bistate) { rel->rd_tableam->tuple_insert(rel, slot, cid, options, bistate); @@ -1385,7 +1385,7 @@ table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, static inline void table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot, CommandId cid, int options, - struct BulkInsertStateData *bistate, + BulkInsertStateData *bistate, uint32 specToken) { rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options, @@ -1420,7 +1420,7 @@ table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot, */ static inline void table_multi_insert(Relation rel, TupleTableSlot **slots, int nslots, - CommandId cid, int options, struct BulkInsertStateData *bistate) + CommandId cid, int options, BulkInsertStateData *bistate) { rel->rd_tableam->multi_insert(rel, slots, nslots, cid, options, bistate); @@ -1743,7 +1743,7 @@ table_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin, static inline double table_index_build_scan(Relation table_rel, Relation index_rel, - struct IndexInfo *index_info, + IndexInfo *index_info, bool allow_sync, bool progress, IndexBuildCallback callback, @@ -1776,7 +1776,7 @@ table_index_build_scan(Relation table_rel, static inline double table_index_build_range_scan(Relation table_rel, Relation index_rel, - struct IndexInfo *index_info, + IndexInfo *index_info, bool allow_sync, bool anyvisible, bool progress, @@ -1807,9 +1807,9 @@ table_index_build_range_scan(Relation table_rel, static inline void table_index_validate_scan(Relation table_rel, Relation index_rel, - struct IndexInfo *index_info, + IndexInfo *index_info, Snapshot snapshot, - struct ValidateIndexState *state) + ValidateIndexState *state) { table_rel->rd_tableam->index_validate_scan(table_rel, index_rel, @@ -1963,7 +1963,7 @@ table_scan_bitmap_next_tuple(TableScanDesc scan, */ static inline bool table_scan_sample_next_block(TableScanDesc scan, - struct SampleScanState *scanstate) + SampleScanState *scanstate) { /* * We don't expect direct calls to table_scan_sample_next_block with valid @@ -1985,7 +1985,7 @@ table_scan_sample_next_block(TableScanDesc scan, */ static inline bool table_scan_sample_next_tuple(TableScanDesc scan, - struct SampleScanState *scanstate, + SampleScanState *scanstate, TupleTableSlot *slot) { /* diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 3a920cc7d17..a36653c37f9 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1656,14 +1656,14 @@ typedef struct SampleScanState */ typedef struct { - struct ScanKeyData *scan_key; /* scankey to put value into */ + ScanKeyData *scan_key; /* scankey to put value into */ ExprState *key_expr; /* expr to evaluate to get value */ bool key_toastable; /* is expr's result a toastable datatype? */ } IndexRuntimeKeyInfo; typedef struct { - struct ScanKeyData *scan_key; /* scankey to put value into */ + ScanKeyData *scan_key; /* scankey to put value into */ ExprState *array_expr; /* expr to evaluate to get array value */ int next_elem; /* next array element to use */ int num_elems; /* number of elems in current array value */ @@ -1704,9 +1704,9 @@ typedef struct IndexScanState ScanState ss; /* its first field is NodeTag */ ExprState *indexqualorig; List *indexorderbyorig; - struct ScanKeyData *iss_ScanKeys; + ScanKeyData *iss_ScanKeys; int iss_NumScanKeys; - struct ScanKeyData *iss_OrderByKeys; + ScanKeyData *iss_OrderByKeys; int iss_NumOrderByKeys; IndexRuntimeKeyInfo *iss_RuntimeKeys; int iss_NumRuntimeKeys; @@ -1755,9 +1755,9 @@ typedef struct IndexOnlyScanState { ScanState ss; /* its first field is NodeTag */ ExprState *recheckqual; - struct ScanKeyData *ioss_ScanKeys; + ScanKeyData *ioss_ScanKeys; int ioss_NumScanKeys; - struct ScanKeyData *ioss_OrderByKeys; + ScanKeyData *ioss_OrderByKeys; int ioss_NumOrderByKeys; IndexRuntimeKeyInfo *ioss_RuntimeKeys; int ioss_NumRuntimeKeys; @@ -1796,7 +1796,7 @@ typedef struct BitmapIndexScanState { ScanState ss; /* its first field is NodeTag */ TIDBitmap *biss_result; - struct ScanKeyData *biss_ScanKeys; + ScanKeyData *biss_ScanKeys; int biss_NumScanKeys; IndexRuntimeKeyInfo *biss_RuntimeKeys; int biss_NumRuntimeKeys; |