mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +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:
@ -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 */
|
||||
|
Reference in New Issue
Block a user