mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +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:
@@ -405,7 +405,7 @@ compileTheLexeme(DictThesaurus *d)
|
||||
{
|
||||
TSLexeme *ptr;
|
||||
|
||||
if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */
|
||||
if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */
|
||||
newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, NULL, d->wrds[i].entries, 0);
|
||||
else
|
||||
{
|
||||
|
@@ -827,7 +827,7 @@ get_nextfield(char **str, char *next)
|
||||
|
||||
*next = '\0';
|
||||
|
||||
return (state == PAE_INMASK); /* OK if we got a nonempty field */
|
||||
return (state == PAE_INMASK); /* OK if we got a nonempty field */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -28,7 +28,7 @@ t_isdigit(const char *ptr)
|
||||
{
|
||||
int clen = pg_mblen(ptr);
|
||||
wchar_t character[2];
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
|
||||
if (clen == 1 || lc_ctype_is_c(collation))
|
||||
@@ -44,7 +44,7 @@ t_isspace(const char *ptr)
|
||||
{
|
||||
int clen = pg_mblen(ptr);
|
||||
wchar_t character[2];
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
|
||||
if (clen == 1 || lc_ctype_is_c(collation))
|
||||
@@ -60,7 +60,7 @@ t_isalpha(const char *ptr)
|
||||
{
|
||||
int clen = pg_mblen(ptr);
|
||||
wchar_t character[2];
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
|
||||
if (clen == 1 || lc_ctype_is_c(collation))
|
||||
@@ -76,7 +76,7 @@ t_isprint(const char *ptr)
|
||||
{
|
||||
int clen = pg_mblen(ptr);
|
||||
wchar_t character[2];
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
|
||||
if (clen == 1 || lc_ctype_is_c(collation))
|
||||
@@ -86,7 +86,7 @@ t_isprint(const char *ptr)
|
||||
|
||||
return iswprint((wint_t) character[0]);
|
||||
}
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
|
||||
|
||||
/*
|
||||
@@ -246,7 +246,7 @@ lowerstr_with_len(const char *str, int len)
|
||||
char *out;
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
#endif
|
||||
|
||||
@@ -300,7 +300,7 @@ lowerstr_with_len(const char *str, int len)
|
||||
Assert(wlen < len);
|
||||
}
|
||||
else
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
{
|
||||
const char *ptr = str;
|
||||
char *outptr;
|
||||
|
@@ -423,7 +423,7 @@ compute_tsvector_stats(VacAttrStats *stats,
|
||||
stats->stats_valid = true;
|
||||
stats->stanullfrac = 1.0;
|
||||
stats->stawidth = 0; /* "unknown" */
|
||||
stats->stadistinct = 0.0; /* "unknown" */
|
||||
stats->stadistinct = 0.0; /* "unknown" */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -199,10 +199,10 @@ typedef enum
|
||||
/* forward declaration */
|
||||
struct TParser;
|
||||
|
||||
typedef int (*TParserCharTest) (struct TParser *); /* any p_is* functions
|
||||
* except p_iseq */
|
||||
typedef void (*TParserSpecial) (struct TParser *); /* special handler for
|
||||
* special cases... */
|
||||
typedef int (*TParserCharTest) (struct TParser *); /* any p_is* functions
|
||||
* except p_iseq */
|
||||
typedef void (*TParserSpecial) (struct TParser *); /* special handler for
|
||||
* special cases... */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -302,7 +302,7 @@ TParserInit(char *str, int len)
|
||||
if (prs->charmaxlen > 1)
|
||||
{
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
|
||||
prs->usewide = true;
|
||||
if (lc_ctype_is_c(collation))
|
||||
@@ -560,7 +560,7 @@ p_iseq(TParser *prs, char c)
|
||||
|
||||
p_iswhat(alnum)
|
||||
p_iswhat(alpha)
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
|
||||
p_iswhat(digit)
|
||||
p_iswhat(lower)
|
||||
@@ -1697,7 +1697,7 @@ static const TParserStateActionItem actionTPS_InHyphenUnsignedInt[] = {
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const TParserStateActionItem *action; /* the actual state info */
|
||||
const TParserStateActionItem *action; /* the actual state info */
|
||||
TParserState state; /* only for Assert crosscheck */
|
||||
#ifdef WPARSER_TRACE
|
||||
const char *state_name; /* only for debug printout */
|
||||
|
Reference in New Issue
Block a user