mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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 e3860ffa4d
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/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
@ -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();
|
||||
|
@ -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 */
|
||||
|
@ -289,5 +289,5 @@ PostmasterIsAlive(void)
|
||||
return false;
|
||||
#else /* WIN32 */
|
||||
return (WaitForSingleObject(PostmasterHandle, 0) == WAIT_TIMEOUT);
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
||||
/* ----------------------------------------------
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user