mirror of
https://github.com/postgres/postgres.git
synced 2026-02-18 18:25:17 -05:00
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
74 lines
2.1 KiB
C
74 lines
2.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* relpath.h
|
|
* Declarations for GetRelationPath() and friends
|
|
*
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/common/relpath.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef RELPATH_H
|
|
#define RELPATH_H
|
|
|
|
/*
|
|
* Stuff for fork names.
|
|
*
|
|
* The physical storage of a relation consists of one or more forks.
|
|
* The main fork is always created, but in addition to that there can be
|
|
* additional forks for storing various metadata. ForkNumber is used when
|
|
* we need to refer to a specific fork in a relation.
|
|
*/
|
|
typedef enum ForkNumber
|
|
{
|
|
InvalidForkNumber = -1,
|
|
MAIN_FORKNUM = 0,
|
|
FSM_FORKNUM,
|
|
VISIBILITYMAP_FORKNUM,
|
|
INIT_FORKNUM
|
|
|
|
/*
|
|
* NOTE: if you add a new fork, change MAX_FORKNUM and possibly
|
|
* FORKNAMECHARS below, and update the forkNames array in
|
|
* src/common/relpath.c
|
|
*/
|
|
} ForkNumber;
|
|
|
|
#define MAX_FORKNUM INIT_FORKNUM
|
|
|
|
#define FORKNAMECHARS 4 /* max chars for a fork name */
|
|
|
|
extern const char *const forkNames[];
|
|
|
|
extern ForkNumber forkname_to_number(const char *forkName);
|
|
extern int forkname_chars(const char *str, ForkNumber *fork);
|
|
|
|
/*
|
|
* Stuff for computing filesystem pathnames for relations.
|
|
*/
|
|
extern char *GetDatabasePath(Oid dbNode, Oid spcNode);
|
|
|
|
extern char *GetRelationPath(Oid dbNode, Oid spcNode, Oid relNode,
|
|
int backendId, ForkNumber forkNumber);
|
|
|
|
/*
|
|
* Wrapper macros for GetRelationPath. Beware of multiple
|
|
* evaluation of the RelFileNode or RelFileNodeBackend argument!
|
|
*/
|
|
|
|
/* First argument is a RelFileNode */
|
|
#define relpathbackend(rnode, backend, forknum) \
|
|
GetRelationPath((rnode).dbNode, (rnode).spcNode, (rnode).relNode, \
|
|
backend, forknum)
|
|
|
|
/* First argument is a RelFileNode */
|
|
#define relpathperm(rnode, forknum) \
|
|
relpathbackend(rnode, InvalidBackendId, forknum)
|
|
|
|
/* First argument is a RelFileNodeBackend */
|
|
#define relpath(rnode, forknum) \
|
|
relpathbackend((rnode).node, (rnode).backend, forknum)
|
|
|
|
#endif /* RELPATH_H */
|