summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc
diff options
context:
space:
mode:
authorTom Lane2017-06-21 19:18:54 +0000
committerTom Lane2017-06-21 19:19:25 +0000
commitc7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch)
treee85979fb1213a731b7b557f8a830df541f26b135 /src/backend/storage/ipc
parentf669c09989bda894d6ba01634ccb229f0687c08a (diff)
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments to the right of code, and remove pgindent hack that caused comments following #endif to not obey the general rule. Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using the published version of pg_bsd_indent, but a hacked-up version that tried to minimize the amount of movement of comments to the right of code. The situation of interest is where such a comment has to be moved to the right of its default placement at column 33 because there's code there. BSD indent has always moved right in units of tab stops in such cases --- but in the previous incarnation, indent was working in 8-space tab stops, while now it knows we use 4-space tabs. So the net result is that in about half the cases, such comments are placed one tab stop left of before. This is better all around: it leaves more room on the line for comment text, and it means that in such cases the comment uniformly starts at the next 4-space tab stop after the code, rather than sometimes one and sometimes two tabs after. Also, ensure that comments following #endif are indented the same as comments following other preprocessor commands such as #else. That inconsistency turns out to have been self-inflicted damage from a poorly-thought-through post-indent "fixup" in pgindent. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r--src/backend/storage/ipc/dsm_impl.c6
-rw-r--r--src/backend/storage/ipc/latch.c12
-rw-r--r--src/backend/storage/ipc/pmsignal.c2
-rw-r--r--src/backend/storage/ipc/procarray.c12
-rw-r--r--src/backend/storage/ipc/shmem.c4
-rw-r--r--src/backend/storage/ipc/sinvaladt.c4
6 files changed, 20 insertions, 20 deletions
diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c
index e0eaefeeb34..d101c717d36 100644
--- a/src/backend/storage/ipc/dsm_impl.c
+++ b/src/backend/storage/ipc/dsm_impl.c
@@ -686,9 +686,9 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
hmap = CreateFileMapping(INVALID_HANDLE_VALUE, /* Use the pagefile */
NULL, /* Default security attrs */
- PAGE_READWRITE, /* Memory is read/write */
- size_high, /* Upper 32 bits of size */
- size_low, /* Lower 32 bits of size */
+ PAGE_READWRITE, /* Memory is read/write */
+ size_high, /* Upper 32 bits of size */
+ size_low, /* Lower 32 bits of size */
name);
errcode = GetLastError();
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index 55959de91f3..29eb4ea54f6 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -124,7 +124,7 @@ static int selfpipe_owner_pid = 0;
/* Private function prototypes */
static void sendSelfPipeByte(void);
static void drainSelfPipe(void);
-#endif /* WIN32 */
+#endif /* WIN32 */
#if defined(WAIT_USE_EPOLL)
static void WaitEventAdjustEpoll(WaitEventSet *set, WaitEvent *event, int action);
@@ -230,7 +230,7 @@ InitLatch(volatile Latch *latch)
latch->event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (latch->event == NULL)
elog(ERROR, "CreateEvent failed: error code %lu", GetLastError());
-#endif /* WIN32 */
+#endif /* WIN32 */
}
/*
@@ -576,7 +576,7 @@ CreateWaitEventSet(MemoryContext context, int nevents)
elog(ERROR, "epoll_create failed: %m");
if (fcntl(set->epoll_fd, F_SETFD, FD_CLOEXEC) == -1)
elog(ERROR, "fcntl(F_SETFD) failed on epoll descriptor: %m");
-#endif /* EPOLL_CLOEXEC */
+#endif /* EPOLL_CLOEXEC */
#elif defined(WAIT_USE_WIN32)
/*
@@ -1469,7 +1469,7 @@ latch_sigusr1_handler(void)
if (waiting)
sendSelfPipeByte();
}
-#endif /* !WIN32 */
+#endif /* !WIN32 */
/* Send one byte to the self-pipe, to wake up WaitLatch */
#ifndef WIN32
@@ -1502,7 +1502,7 @@ retry:
return;
}
}
-#endif /* !WIN32 */
+#endif /* !WIN32 */
/*
* Read all available data from the self-pipe
@@ -1550,4 +1550,4 @@ drainSelfPipe(void)
/* else buffer wasn't big enough, so read again */
}
}
-#endif /* !WIN32 */
+#endif /* !WIN32 */
diff --git a/src/backend/storage/ipc/pmsignal.c b/src/backend/storage/ipc/pmsignal.c
index 98f4082d94f..85db6b21f83 100644
--- a/src/backend/storage/ipc/pmsignal.c
+++ b/src/backend/storage/ipc/pmsignal.c
@@ -289,5 +289,5 @@ PostmasterIsAlive(void)
return false;
#else /* WIN32 */
return (WaitForSingleObject(PostmasterHandle, 0) == WAIT_TIMEOUT);
-#endif /* WIN32 */
+#endif /* WIN32 */
}
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index dfddfc4002c..2d6ae23eec5 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -75,7 +75,7 @@ typedef struct ProcArrayStruct
int numKnownAssignedXids; /* current # of valid entries */
int tailKnownAssignedXids; /* index of oldest valid element */
int headKnownAssignedXids; /* index of newest element, + 1 */
- slock_t known_assigned_xids_lck; /* protects head/tail pointers */
+ slock_t known_assigned_xids_lck; /* protects head/tail pointers */
/*
* Highest subxid that has been removed from KnownAssignedXids array to
@@ -149,7 +149,7 @@ static void DisplayXidCache(void);
#define xc_by_known_assigned_inc() ((void) 0)
#define xc_no_overflow_inc() ((void) 0)
#define xc_slow_answer_inc() ((void) 0)
-#endif /* XIDCACHE_DEBUG */
+#endif /* XIDCACHE_DEBUG */
/* Primitives for KnownAssignedXids array handling for standby */
static void KnownAssignedXidsCompress(bool force);
@@ -364,7 +364,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid)
/* Keep the PGPROC array sorted. See notes above */
memmove(&arrayP->pgprocnos[index], &arrayP->pgprocnos[index + 1],
(arrayP->numProcs - index - 1) * sizeof(int));
- arrayP->pgprocnos[arrayP->numProcs - 1] = -1; /* for debugging */
+ arrayP->pgprocnos[arrayP->numProcs - 1] = -1; /* for debugging */
arrayP->numProcs--;
LWLockRelease(ProcArrayLock);
return;
@@ -432,7 +432,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
pgxact->xmin = InvalidTransactionId;
/* must be cleared with xid/xmin: */
pgxact->vacuumFlags &= ~PROC_VACUUM_STATE_MASK;
- pgxact->delayChkpt = false; /* be sure this is cleared in abort */
+ pgxact->delayChkpt = false; /* be sure this is cleared in abort */
proc->recoveryConflictPending = false;
Assert(pgxact->nxids == 0);
@@ -1354,7 +1354,7 @@ GetOldestXmin(Relation rel, int flags)
if (allDbs ||
proc->databaseId == MyDatabaseId ||
- proc->databaseId == 0) /* always include WalSender */
+ proc->databaseId == 0) /* always include WalSender */
{
/* Fetch xid just once - see GetNewTransactionId */
TransactionId xid = pgxact->xid;
@@ -3099,7 +3099,7 @@ DisplayXidCache(void)
xc_no_overflow,
xc_slow_answer);
}
-#endif /* XIDCACHE_DEBUG */
+#endif /* XIDCACHE_DEBUG */
/* ----------------------------------------------
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index b5f49727f7a..e18d4c7e1c0 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -75,7 +75,7 @@
/* shared memory global variables */
-static PGShmemHeader *ShmemSegHdr; /* shared mem segment header */
+static PGShmemHeader *ShmemSegHdr; /* shared mem segment header */
static void *ShmemBase; /* start address of shared memory */
@@ -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 */
diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c
index 18302caf5ec..1b9d32b7cff 100644
--- a/src/backend/storage/ipc/sinvaladt.c
+++ b/src/backend/storage/ipc/sinvaladt.c
@@ -240,7 +240,7 @@ CreateSharedInvalidationState(void)
/* Mark all backends inactive, and initialize nextLXID */
for (i = 0; i < shmInvalBuffer->maxBackends; i++)
{
- shmInvalBuffer->procState[i].procPid = 0; /* inactive */
+ shmInvalBuffer->procState[i].procPid = 0; /* inactive */
shmInvalBuffer->procState[i].proc = NULL;
shmInvalBuffer->procState[i].nextMsgNum = 0; /* meaningless */
shmInvalBuffer->procState[i].resetState = false;
@@ -271,7 +271,7 @@ SharedInvalBackendInit(bool sendOnly)
/* Look for a free entry in the procState array */
for (index = 0; index < segP->lastBackend; index++)
{
- if (segP->procState[index].procPid == 0) /* inactive slot? */
+ if (segP->procState[index].procPid == 0) /* inactive slot? */
{
stateP = &segP->procState[index];
break;