mirror of
https://github.com/postgres/postgres.git
synced 2025-10-18 04:29:09 +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:
@@ -16,4 +16,4 @@ extern int pg_b64_decode(const char *src, int len, char *dst);
|
||||
extern int pg_b64_enc_len(int srclen);
|
||||
extern int pg_b64_dec_len(int srclen);
|
||||
|
||||
#endif /* BASE64_H */
|
||||
#endif /* BASE64_H */
|
||||
|
@@ -18,4 +18,4 @@ typedef struct ConfigData
|
||||
extern ConfigData *get_configdata(const char *my_exec_path,
|
||||
size_t *configdata_len);
|
||||
|
||||
#endif /* COMMON_CONFIG_INFO_H */
|
||||
#endif /* COMMON_CONFIG_INFO_H */
|
||||
|
@@ -14,4 +14,4 @@
|
||||
|
||||
extern ControlFileData *get_controlfile(const char *DataDir, const char *progname, bool *crc_ok_p);
|
||||
|
||||
#endif /* COMMON_CONTROLDATA_UTILS_H */
|
||||
#endif /* COMMON_CONTROLDATA_UTILS_H */
|
||||
|
@@ -41,4 +41,4 @@ extern void pfree(void *pointer);
|
||||
extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
|
||||
extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);
|
||||
|
||||
#endif /* FE_MEMUTILS_H */
|
||||
#endif /* FE_MEMUTILS_H */
|
||||
|
@@ -24,4 +24,4 @@ extern int durable_rename(const char *oldfile, const char *newfile,
|
||||
const char *progname);
|
||||
extern int fsync_parent_path(const char *fname, const char *progname);
|
||||
|
||||
#endif /* FILE_UTILS_H */
|
||||
#endif /* FILE_UTILS_H */
|
||||
|
@@ -271,6 +271,6 @@ int128_to_int64(INT128 val)
|
||||
return (int64) val.lo;
|
||||
}
|
||||
|
||||
#endif /* USE_NATIVE_INT128 */
|
||||
#endif /* USE_NATIVE_INT128 */
|
||||
|
||||
#endif /* INT128_H */
|
||||
#endif /* INT128_H */
|
||||
|
@@ -34,4 +34,4 @@ extern int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen,
|
||||
char *service, int servicelen,
|
||||
int flags);
|
||||
|
||||
#endif /* IP_H */
|
||||
#endif /* IP_H */
|
||||
|
@@ -41,4 +41,4 @@ extern const ScanKeyword *ScanKeywordLookup(const char *text,
|
||||
const ScanKeyword *keywords,
|
||||
int num_keywords);
|
||||
|
||||
#endif /* KEYWORDS_H */
|
||||
#endif /* KEYWORDS_H */
|
||||
|
@@ -88,4 +88,4 @@ extern int32 pglz_compress(const char *source, int32 slen, char *dest,
|
||||
extern int32 pglz_decompress(const char *source, int32 slen, char *dest,
|
||||
int32 rawsize);
|
||||
|
||||
#endif /* _PG_LZCOMPRESS_H_ */
|
||||
#endif /* _PG_LZCOMPRESS_H_ */
|
||||
|
@@ -71,4 +71,4 @@ extern char *GetRelationPath(Oid dbNode, Oid spcNode, Oid relNode,
|
||||
#define relpath(rnode, forknum) \
|
||||
relpathbackend((rnode).node, (rnode).backend, forknum)
|
||||
|
||||
#endif /* RELPATH_H */
|
||||
#endif /* RELPATH_H */
|
||||
|
@@ -21,4 +21,4 @@ void get_restricted_token(const char *progname);
|
||||
HANDLE CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, const char *progname);
|
||||
#endif
|
||||
|
||||
#endif /* COMMON_RESTRICTED_TOKEN_H */
|
||||
#endif /* COMMON_RESTRICTED_TOKEN_H */
|
||||
|
@@ -27,4 +27,4 @@ typedef enum
|
||||
|
||||
extern pg_saslprep_rc pg_saslprep(const char *input, char **output);
|
||||
|
||||
#endif /* SASLPREP_H */
|
||||
#endif /* SASLPREP_H */
|
||||
|
@@ -56,4 +56,4 @@ extern void scram_ServerKey(const uint8 *salted_password, uint8 *result);
|
||||
extern char *scram_build_verifier(const char *salt, int saltlen, int iterations,
|
||||
const char *password);
|
||||
|
||||
#endif /* SCRAM_COMMON_H */
|
||||
#endif /* SCRAM_COMMON_H */
|
||||
|
@@ -89,7 +89,7 @@ typedef struct pg_sha512_ctx
|
||||
} pg_sha512_ctx;
|
||||
typedef struct pg_sha256_ctx pg_sha224_ctx;
|
||||
typedef struct pg_sha512_ctx pg_sha384_ctx;
|
||||
#endif /* USE_SSL */
|
||||
#endif /* USE_SSL */
|
||||
|
||||
/* Interface routines for SHA224/256/384/512 */
|
||||
extern void pg_sha224_init(pg_sha224_ctx *ctx);
|
||||
@@ -112,4 +112,4 @@ extern void pg_sha512_update(pg_sha512_ctx *ctx, const uint8 *input0,
|
||||
size_t len);
|
||||
extern void pg_sha512_final(pg_sha512_ctx *ctx, uint8 *dest);
|
||||
|
||||
#endif /* _PG_SHA2_H_ */
|
||||
#endif /* _PG_SHA2_H_ */
|
||||
|
@@ -12,4 +12,4 @@
|
||||
|
||||
extern bool pg_str_endswith(const char *str, const char *end);
|
||||
|
||||
#endif /* COMMON_STRING_H */
|
||||
#endif /* COMMON_STRING_H */
|
||||
|
@@ -18,4 +18,4 @@
|
||||
|
||||
extern pg_wchar *unicode_normalize_kc(const pg_wchar *input);
|
||||
|
||||
#endif /* UNICODE_NORM_H */
|
||||
#endif /* UNICODE_NORM_H */
|
||||
|
@@ -37,14 +37,14 @@ typedef struct
|
||||
static const pg_unicode_decomposition UnicodeDecompMain[6532] =
|
||||
{
|
||||
{0x00A0, 0, 1 | DECOMP_INLINE, 0x0020},
|
||||
{0x00A8, 0, 2 | DECOMP_NO_COMPOSE, 0}, /* compatibility mapping */
|
||||
{0x00A8, 0, 2 | DECOMP_NO_COMPOSE, 0}, /* compatibility mapping */
|
||||
{0x00AA, 0, 1 | DECOMP_INLINE, 0x0061},
|
||||
{0x00AF, 0, 2 | DECOMP_NO_COMPOSE, 2}, /* compatibility mapping */
|
||||
{0x00AF, 0, 2 | DECOMP_NO_COMPOSE, 2}, /* compatibility mapping */
|
||||
{0x00B2, 0, 1 | DECOMP_INLINE, 0x0032},
|
||||
{0x00B3, 0, 1 | DECOMP_INLINE, 0x0033},
|
||||
{0x00B4, 0, 2 | DECOMP_NO_COMPOSE, 4}, /* compatibility mapping */
|
||||
{0x00B4, 0, 2 | DECOMP_NO_COMPOSE, 4}, /* compatibility mapping */
|
||||
{0x00B5, 0, 1 | DECOMP_INLINE, 0x03BC},
|
||||
{0x00B8, 0, 2 | DECOMP_NO_COMPOSE, 6}, /* compatibility mapping */
|
||||
{0x00B8, 0, 2 | DECOMP_NO_COMPOSE, 6}, /* compatibility mapping */
|
||||
{0x00B9, 0, 1 | DECOMP_INLINE, 0x0031},
|
||||
{0x00BA, 0, 1 | DECOMP_INLINE, 0x006F},
|
||||
{0x00BC, 0, 3, 8},
|
||||
|
@@ -12,4 +12,4 @@
|
||||
extern const char *get_user_name(char **errstr);
|
||||
extern const char *get_user_name_or_exit(const char *progname);
|
||||
|
||||
#endif /* USERNAME_H */
|
||||
#endif /* USERNAME_H */
|
||||
|
Reference in New Issue
Block a user