Skip to content

Commit be5942a

Browse files
committed
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
1 parent 110eb4a commit be5942a

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

src/backend/commands/async.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,10 @@ typedef struct NotificationList
396396

397397
#define MIN_HASHABLE_NOTIFIES 16 /* threshold to build hashtab */
398398

399-
typedef struct NotificationHash
399+
struct NotificationHash
400400
{
401401
Notification *event; /* => the actual Notification struct */
402-
} NotificationHash;
402+
};
403403

404404
static NotificationList *pendingNotifies = NULL;
405405

@@ -2299,7 +2299,7 @@ AddEventToPendingNotifies(Notification *n)
22992299

23002300
/* Create the hash table */
23012301
hash_ctl.keysize = sizeof(Notification *);
2302-
hash_ctl.entrysize = sizeof(NotificationHash);
2302+
hash_ctl.entrysize = sizeof(struct NotificationHash);
23032303
hash_ctl.hash = notification_hash;
23042304
hash_ctl.match = notification_match;
23052305
hash_ctl.hcxt = CurTransactionContext;

src/backend/utils/resowner/resowner.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ StaticAssertDecl(RESOWNER_HASH_MAX_ITEMS(RESOWNER_HASH_INIT_SIZE) >= RESOWNER_AR
107107
/*
108108
* ResourceOwner objects look like this
109109
*/
110-
typedef struct ResourceOwnerData
110+
struct ResourceOwnerData
111111
{
112112
ResourceOwner parent; /* NULL if no parent (toplevel owner) */
113113
ResourceOwner firstchild; /* head of linked list of children */
@@ -155,7 +155,7 @@ typedef struct ResourceOwnerData
155155

156156
/* The local locks cache. */
157157
LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */
158-
} ResourceOwnerData;
158+
};
159159

160160

161161
/*****************************************************************************
@@ -415,7 +415,7 @@ ResourceOwnerCreate(ResourceOwner parent, const char *name)
415415
ResourceOwner owner;
416416

417417
owner = (ResourceOwner) MemoryContextAllocZero(TopMemoryContext,
418-
sizeof(ResourceOwnerData));
418+
sizeof(struct ResourceOwnerData));
419419
owner->name = name;
420420

421421
if (parent)

src/include/access/xlog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020

2121
/* Sync methods */
22-
typedef enum WalSyncMethod
22+
enum WalSyncMethod
2323
{
2424
WAL_SYNC_METHOD_FSYNC = 0,
2525
WAL_SYNC_METHOD_FDATASYNC,
2626
WAL_SYNC_METHOD_OPEN, /* for O_SYNC */
2727
WAL_SYNC_METHOD_FSYNC_WRITETHROUGH,
2828
WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */
29-
} WalSyncMethod;
29+
};
3030
extern PGDLLIMPORT int wal_sync_method;
3131

3232
extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr;

src/include/storage/bufmgr.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,10 @@ typedef struct BufferManagerRelation
107107
#define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel})
108108
#define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence})
109109

110-
typedef enum ReadBuffersFlags
111-
{
112-
/* Zero out page if reading fails. */
113-
READ_BUFFERS_ZERO_ON_ERROR = (1 << 0),
114-
115-
/* Call smgrprefetch() if I/O necessary. */
116-
READ_BUFFERS_ISSUE_ADVICE = (1 << 1),
117-
} ReadBuffersFlags;
110+
/* Zero out page if reading fails. */
111+
#define READ_BUFFERS_ZERO_ON_ERROR (1 << 0)
112+
/* Call smgrprefetch() if I/O necessary. */
113+
#define READ_BUFFERS_ISSUE_ADVICE (1 << 1)
118114

119115
struct ReadBuffersOperation
120116
{

src/tools/pgindent/typedefs.list

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,6 @@ Node
16921692
NodeTag
16931693
NonEmptyRange
16941694
Notification
1695-
NotificationHash
16961695
NotificationList
16971696
NotifyStmt
16981697
Nsrt
@@ -2326,7 +2325,6 @@ ReInitializeDSMForeignScan_function
23262325
ReScanForeignScan_function
23272326
ReadBufPtrType
23282327
ReadBufferMode
2329-
ReadBuffersFlags
23302328
ReadBuffersOperation
23312329
ReadBytePtrType
23322330
ReadExtraTocPtrType
@@ -2443,7 +2441,6 @@ ReservoirState
24432441
ReservoirStateData
24442442
ResourceElem
24452443
ResourceOwner
2446-
ResourceOwnerData
24472444
ResourceOwnerDesc
24482445
ResourceReleaseCallback
24492446
ResourceReleaseCallbackItem
@@ -3127,7 +3124,6 @@ WalSndState
31273124
WalSummarizerData
31283125
WalSummaryFile
31293126
WalSummaryIO
3130-
WalSyncMethod
31313127
WalTimeSample
31323128
WalUsage
31333129
WalWriteMethod

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy