Remove unused typedefs

There were a few typedefs that were never used to define a variable or
field.  This had the effect that the buildfarm's typedefs.list would
not include them, and so they would need to be re-added manually to
keep the overall pgindent result perfectly clean.

We can easily get rid of these typedefs to avoid the issue.  In a few
cases, we just let the enum or struct stand on its own without a
typedef around it.  In one case, an enum was abused to define flag
bits; that's better done with macro definitions.

This fixes all the remaining issues with missing entries in the
buildfarm's typedefs.list.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/1919000.1715815925@sss.pgh.pa.us
This commit is contained in:
Peter Eisentraut 2024-05-17 07:30:19 +02:00
parent 110eb4aefb
commit be5942aee7
5 changed files with 12 additions and 20 deletions

View File

@ -396,10 +396,10 @@ typedef struct NotificationList
#define MIN_HASHABLE_NOTIFIES 16 /* threshold to build hashtab */ #define MIN_HASHABLE_NOTIFIES 16 /* threshold to build hashtab */
typedef struct NotificationHash struct NotificationHash
{ {
Notification *event; /* => the actual Notification struct */ Notification *event; /* => the actual Notification struct */
} NotificationHash; };
static NotificationList *pendingNotifies = NULL; static NotificationList *pendingNotifies = NULL;
@ -2299,7 +2299,7 @@ AddEventToPendingNotifies(Notification *n)
/* Create the hash table */ /* Create the hash table */
hash_ctl.keysize = sizeof(Notification *); hash_ctl.keysize = sizeof(Notification *);
hash_ctl.entrysize = sizeof(NotificationHash); hash_ctl.entrysize = sizeof(struct NotificationHash);
hash_ctl.hash = notification_hash; hash_ctl.hash = notification_hash;
hash_ctl.match = notification_match; hash_ctl.match = notification_match;
hash_ctl.hcxt = CurTransactionContext; hash_ctl.hcxt = CurTransactionContext;

View File

@ -107,7 +107,7 @@ StaticAssertDecl(RESOWNER_HASH_MAX_ITEMS(RESOWNER_HASH_INIT_SIZE) >= RESOWNER_AR
/* /*
* ResourceOwner objects look like this * ResourceOwner objects look like this
*/ */
typedef struct ResourceOwnerData struct ResourceOwnerData
{ {
ResourceOwner parent; /* NULL if no parent (toplevel owner) */ ResourceOwner parent; /* NULL if no parent (toplevel owner) */
ResourceOwner firstchild; /* head of linked list of children */ ResourceOwner firstchild; /* head of linked list of children */
@ -155,7 +155,7 @@ typedef struct ResourceOwnerData
/* The local locks cache. */ /* The local locks cache. */
LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */ LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */
} ResourceOwnerData; };
/***************************************************************************** /*****************************************************************************
@ -415,7 +415,7 @@ ResourceOwnerCreate(ResourceOwner parent, const char *name)
ResourceOwner owner; ResourceOwner owner;
owner = (ResourceOwner) MemoryContextAllocZero(TopMemoryContext, owner = (ResourceOwner) MemoryContextAllocZero(TopMemoryContext,
sizeof(ResourceOwnerData)); sizeof(struct ResourceOwnerData));
owner->name = name; owner->name = name;
if (parent) if (parent)

View File

@ -19,14 +19,14 @@
/* Sync methods */ /* Sync methods */
typedef enum WalSyncMethod enum WalSyncMethod
{ {
WAL_SYNC_METHOD_FSYNC = 0, WAL_SYNC_METHOD_FSYNC = 0,
WAL_SYNC_METHOD_FDATASYNC, WAL_SYNC_METHOD_FDATASYNC,
WAL_SYNC_METHOD_OPEN, /* for O_SYNC */ WAL_SYNC_METHOD_OPEN, /* for O_SYNC */
WAL_SYNC_METHOD_FSYNC_WRITETHROUGH, WAL_SYNC_METHOD_FSYNC_WRITETHROUGH,
WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */ WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */
} WalSyncMethod; };
extern PGDLLIMPORT int wal_sync_method; extern PGDLLIMPORT int wal_sync_method;
extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr; extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr;

View File

@ -107,14 +107,10 @@ typedef struct BufferManagerRelation
#define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel}) #define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel})
#define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence}) #define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence})
typedef enum ReadBuffersFlags
{
/* Zero out page if reading fails. */ /* Zero out page if reading fails. */
READ_BUFFERS_ZERO_ON_ERROR = (1 << 0), #define READ_BUFFERS_ZERO_ON_ERROR (1 << 0)
/* Call smgrprefetch() if I/O necessary. */ /* Call smgrprefetch() if I/O necessary. */
READ_BUFFERS_ISSUE_ADVICE = (1 << 1), #define READ_BUFFERS_ISSUE_ADVICE (1 << 1)
} ReadBuffersFlags;
struct ReadBuffersOperation struct ReadBuffersOperation
{ {

View File

@ -1692,7 +1692,6 @@ Node
NodeTag NodeTag
NonEmptyRange NonEmptyRange
Notification Notification
NotificationHash
NotificationList NotificationList
NotifyStmt NotifyStmt
Nsrt Nsrt
@ -2326,7 +2325,6 @@ ReInitializeDSMForeignScan_function
ReScanForeignScan_function ReScanForeignScan_function
ReadBufPtrType ReadBufPtrType
ReadBufferMode ReadBufferMode
ReadBuffersFlags
ReadBuffersOperation ReadBuffersOperation
ReadBytePtrType ReadBytePtrType
ReadExtraTocPtrType ReadExtraTocPtrType
@ -2443,7 +2441,6 @@ ReservoirState
ReservoirStateData ReservoirStateData
ResourceElem ResourceElem
ResourceOwner ResourceOwner
ResourceOwnerData
ResourceOwnerDesc ResourceOwnerDesc
ResourceReleaseCallback ResourceReleaseCallback
ResourceReleaseCallbackItem ResourceReleaseCallbackItem
@ -3127,7 +3124,6 @@ WalSndState
WalSummarizerData WalSummarizerData
WalSummaryFile WalSummaryFile
WalSummaryIO WalSummaryIO
WalSyncMethod
WalTimeSample WalTimeSample
WalUsage WalUsage
WalWriteMethod WalWriteMethod