mirror of
https://github.com/postgres/postgres.git
synced 2025-11-26 23:43:30 +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:
@@ -2118,7 +2118,7 @@ BgBufferSync(WritebackContext *wb_context)
|
||||
int32 passes_delta = strategy_passes - prev_strategy_passes;
|
||||
|
||||
strategy_delta = strategy_buf_id - prev_strategy_buf_id;
|
||||
strategy_delta += (long) passes_delta *NBuffers;
|
||||
strategy_delta += (long) passes_delta * NBuffers;
|
||||
|
||||
Assert(strategy_delta >= 0);
|
||||
|
||||
@@ -4195,7 +4195,7 @@ ckpt_buforder_comparator(const void *pa, const void *pb)
|
||||
/* compare block number */
|
||||
else if (a->blockNum < b->blockNum)
|
||||
return -1;
|
||||
else /* should not be the same block ... */
|
||||
else /* should not be the same block ... */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ typedef struct BufferAccessStrategyData
|
||||
* struct.
|
||||
*/
|
||||
Buffer buffers[FLEXIBLE_ARRAY_MEMBER];
|
||||
} BufferAccessStrategyData;
|
||||
} BufferAccessStrategyData;
|
||||
|
||||
|
||||
/* Prototypes for internal functions */
|
||||
|
||||
@@ -1160,5 +1160,5 @@ static uint64
|
||||
dsm_control_bytes_needed(uint32 nitems)
|
||||
{
|
||||
return offsetof(dsm_control_header, item)
|
||||
+sizeof(dsm_control_item) * (uint64) nitems;
|
||||
+ sizeof(dsm_control_item) * (uint64) nitems;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ static shm_mq_result shm_mq_receive_bytes(shm_mq *mq, Size bytes_needed,
|
||||
bool nowait, Size *nbytesp, void **datap);
|
||||
static bool shm_mq_counterparty_gone(volatile shm_mq *mq,
|
||||
BackgroundWorkerHandle *handle);
|
||||
static bool shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr,
|
||||
static bool shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile *ptr,
|
||||
BackgroundWorkerHandle *handle);
|
||||
static uint64 shm_mq_get_bytes_read(volatile shm_mq *mq, bool *detached);
|
||||
static void shm_mq_inc_bytes_read(volatile shm_mq *mq, Size n);
|
||||
@@ -365,7 +365,7 @@ shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov, int iovcnt, bool nowait)
|
||||
{
|
||||
Assert(mqh->mqh_partial_bytes < sizeof(Size));
|
||||
res = shm_mq_send_bytes(mqh, sizeof(Size) - mqh->mqh_partial_bytes,
|
||||
((char *) &nbytes) +mqh->mqh_partial_bytes,
|
||||
((char *) &nbytes) + mqh->mqh_partial_bytes,
|
||||
nowait, &bytes_written);
|
||||
|
||||
if (res == SHM_MQ_DETACHED)
|
||||
@@ -1053,7 +1053,7 @@ shm_mq_counterparty_gone(volatile shm_mq *mq, BackgroundWorkerHandle *handle)
|
||||
* non-NULL when our counterpart attaches to the queue.
|
||||
*/
|
||||
static bool
|
||||
shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr,
|
||||
shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile *ptr,
|
||||
BackgroundWorkerHandle *handle)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
@@ -96,7 +96,7 @@ shm_toc_allocate(shm_toc *toc, Size nbytes)
|
||||
total_bytes = vtoc->toc_total_bytes;
|
||||
allocated_bytes = vtoc->toc_allocated_bytes;
|
||||
nentry = vtoc->toc_nentry;
|
||||
toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry)
|
||||
toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry)
|
||||
+ allocated_bytes;
|
||||
|
||||
/* Check for memory exhaustion and overflow. */
|
||||
@@ -132,7 +132,7 @@ shm_toc_freespace(shm_toc *toc)
|
||||
nentry = vtoc->toc_nentry;
|
||||
SpinLockRelease(&toc->toc_mutex);
|
||||
|
||||
toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry);
|
||||
toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry);
|
||||
Assert(allocated_bytes + BUFFERALIGN(toc_bytes) <= total_bytes);
|
||||
return total_bytes - (allocated_bytes + BUFFERALIGN(toc_bytes));
|
||||
}
|
||||
@@ -176,7 +176,7 @@ shm_toc_insert(shm_toc *toc, uint64 key, void *address)
|
||||
total_bytes = vtoc->toc_total_bytes;
|
||||
allocated_bytes = vtoc->toc_allocated_bytes;
|
||||
nentry = vtoc->toc_nentry;
|
||||
toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry)
|
||||
toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry)
|
||||
+ allocated_bytes;
|
||||
|
||||
/* Check for memory exhaustion and overflow. */
|
||||
|
||||
@@ -314,7 +314,7 @@ InitShmemIndex(void)
|
||||
* for NULL.
|
||||
*/
|
||||
HTAB *
|
||||
ShmemInitHash(const char *name, /* table string name for shmem index */
|
||||
ShmemInitHash(const char *name, /* table string name for shmem index */
|
||||
long init_size, /* initial table size */
|
||||
long max_size, /* max size of the table */
|
||||
HASHCTL *infoP, /* info about key and bucket size */
|
||||
|
||||
@@ -168,7 +168,7 @@ typedef struct lwlock_stats_key
|
||||
{
|
||||
int tranche;
|
||||
void *instance;
|
||||
} lwlock_stats_key;
|
||||
} lwlock_stats_key;
|
||||
|
||||
typedef struct lwlock_stats
|
||||
{
|
||||
@@ -178,7 +178,7 @@ typedef struct lwlock_stats
|
||||
int block_count;
|
||||
int dequeue_self_count;
|
||||
int spin_delay_count;
|
||||
} lwlock_stats;
|
||||
} lwlock_stats;
|
||||
|
||||
static HTAB *lwlock_stats_htab;
|
||||
static lwlock_stats lwlock_stats_dummy;
|
||||
@@ -232,7 +232,7 @@ LOG_LWDEBUG(const char *where, LWLock *lock, const char *msg)
|
||||
|
||||
static void init_lwlock_stats(void);
|
||||
static void print_lwlock_stats(int code, Datum arg);
|
||||
static lwlock_stats *get_lwlock_stats_entry(LWLock *lockid);
|
||||
static lwlock_stats * get_lwlock_stats_entry(LWLock *lockid);
|
||||
|
||||
static void
|
||||
init_lwlock_stats(void)
|
||||
@@ -851,7 +851,7 @@ LWLockWaitListLock(LWLock *lock)
|
||||
static void
|
||||
LWLockWaitListUnlock(LWLock *lock)
|
||||
{
|
||||
uint32 old_state PG_USED_FOR_ASSERTS_ONLY;
|
||||
uint32 old_state PG_USED_FOR_ASSERTS_ONLY;
|
||||
|
||||
old_state = pg_atomic_fetch_and_u32(&lock->state, ~LW_FLAG_LOCKED);
|
||||
|
||||
@@ -1092,7 +1092,7 @@ LWLockDequeueSelf(LWLock *lock)
|
||||
#ifdef LOCK_DEBUG
|
||||
{
|
||||
/* not waiting anymore */
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
|
||||
Assert(nwaiters < MAX_BACKENDS);
|
||||
}
|
||||
@@ -1242,7 +1242,7 @@ LWLockAcquire(LWLock *lock, LWLockMode mode)
|
||||
#ifdef LOCK_DEBUG
|
||||
{
|
||||
/* not waiting anymore */
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
|
||||
Assert(nwaiters < MAX_BACKENDS);
|
||||
}
|
||||
@@ -1400,7 +1400,7 @@ LWLockAcquireOrWait(LWLock *lock, LWLockMode mode)
|
||||
#ifdef LOCK_DEBUG
|
||||
{
|
||||
/* not waiting anymore */
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
|
||||
Assert(nwaiters < MAX_BACKENDS);
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ LWLockWaitForVar(LWLock *lock, uint64 *valptr, uint64 oldval, uint64 *newval)
|
||||
#ifdef LOCK_DEBUG
|
||||
{
|
||||
/* not waiting anymore */
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1);
|
||||
|
||||
Assert(nwaiters < MAX_BACKENDS);
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ typedef struct OldSerXidControlData
|
||||
TransactionId headXid; /* newest valid Xid in the SLRU */
|
||||
TransactionId tailXid; /* oldest xmin we might be interested in */
|
||||
bool warningIssued; /* have we issued SLRU wrap-around warning? */
|
||||
} OldSerXidControlData;
|
||||
} OldSerXidControlData;
|
||||
|
||||
typedef struct OldSerXidControlData *OldSerXidControl;
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ InitProcGlobal(void)
|
||||
void
|
||||
InitProcess(void)
|
||||
{
|
||||
PGPROC *volatile * procgloballist;
|
||||
PGPROC *volatile *procgloballist;
|
||||
|
||||
/*
|
||||
* ProcGlobal should be set up already (if we are a backend, we inherit
|
||||
@@ -781,7 +781,7 @@ static void
|
||||
ProcKill(int code, Datum arg)
|
||||
{
|
||||
PGPROC *proc;
|
||||
PGPROC *volatile * procgloballist;
|
||||
PGPROC *volatile *procgloballist;
|
||||
|
||||
Assert(MyProc != NULL);
|
||||
|
||||
|
||||
@@ -250,10 +250,10 @@ update_spins_per_delay(int shared_spins_per_delay)
|
||||
static void
|
||||
tas_dummy()
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
__asm__ __volatile__(
|
||||
#if defined(__NetBSD__) && defined(__ELF__)
|
||||
/* no underscore for label and % for registers */
|
||||
"\
|
||||
"\
|
||||
.global tas \n\
|
||||
tas: \n\
|
||||
movel %sp@(0x4),%a0 \n\
|
||||
@@ -265,7 +265,7 @@ _success: \n\
|
||||
moveq #0,%d0 \n\
|
||||
rts \n"
|
||||
#else
|
||||
"\
|
||||
"\
|
||||
.global _tas \n\
|
||||
_tas: \n\
|
||||
movel sp@(0x4),a0 \n\
|
||||
@@ -277,7 +277,7 @@ _success: \n\
|
||||
moveq #0,d0 \n\
|
||||
rts \n"
|
||||
#endif /* __NetBSD__ && __ELF__ */
|
||||
);
|
||||
);
|
||||
}
|
||||
#endif /* __m68k__ && !__linux__ */
|
||||
#endif /* not __GNUC__ */
|
||||
|
||||
@@ -518,7 +518,7 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
|
||||
v = _mdfd_getseg(reln, forknum, blocknum, skipFsync, EXTENSION_CREATE);
|
||||
|
||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
|
||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||
|
||||
@@ -664,7 +664,7 @@ mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
|
||||
|
||||
v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL);
|
||||
|
||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
|
||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||
|
||||
@@ -715,7 +715,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum,
|
||||
Assert(nflush >= 1);
|
||||
Assert(nflush <= nblocks);
|
||||
|
||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
|
||||
FileWriteback(v->mdfd_vfd, seekpos, (off_t) BLCKSZ * nflush, WAIT_EVENT_DATA_FILE_FLUSH);
|
||||
|
||||
@@ -744,7 +744,7 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
v = _mdfd_getseg(reln, forknum, blocknum, false,
|
||||
EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY);
|
||||
|
||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
|
||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||
|
||||
@@ -820,7 +820,7 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
v = _mdfd_getseg(reln, forknum, blocknum, skipFsync,
|
||||
EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY);
|
||||
|
||||
seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
|
||||
|
||||
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
|
||||
|
||||
|
||||
@@ -41,23 +41,23 @@ typedef struct f_smgr
|
||||
void (*smgr_shutdown) (void); /* may be NULL */
|
||||
void (*smgr_close) (SMgrRelation reln, ForkNumber forknum);
|
||||
void (*smgr_create) (SMgrRelation reln, ForkNumber forknum,
|
||||
bool isRedo);
|
||||
bool isRedo);
|
||||
bool (*smgr_exists) (SMgrRelation reln, ForkNumber forknum);
|
||||
void (*smgr_unlink) (RelFileNodeBackend rnode, ForkNumber forknum,
|
||||
bool isRedo);
|
||||
bool isRedo);
|
||||
void (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
||||
void (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum);
|
||||
BlockNumber blocknum);
|
||||
void (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, char *buffer);
|
||||
BlockNumber blocknum, char *buffer);
|
||||
void (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, char *buffer, bool skipFsync);
|
||||
void (*smgr_writeback) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, BlockNumber nblocks);
|
||||
BlockNumber blocknum, BlockNumber nblocks);
|
||||
BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
|
||||
void (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber nblocks);
|
||||
BlockNumber nblocks);
|
||||
void (*smgr_immedsync) (SMgrRelation reln, ForkNumber forknum);
|
||||
void (*smgr_pre_ckpt) (void); /* may be NULL */
|
||||
void (*smgr_sync) (void); /* may be NULL */
|
||||
|
||||
Reference in New Issue
Block a user