diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-06-21 15:18:54 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-06-21 15:19:25 -0400 |
commit | c7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch) | |
tree | e85979fb1213a731b7b557f8a830df541f26b135 /src/backend/regex/regcomp.c | |
parent | f669c09989bda894d6ba01634ccb229f0687c08a (diff) | |
download | postgresql-c7b8998ebbf310a156aa38022555a24d98fdbfb4.tar.gz postgresql-c7b8998ebbf310a156aa38022555a24d98fdbfb4.zip |
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/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'src/backend/regex/regcomp.c')
-rw-r--r-- | src/backend/regex/regcomp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c index 777373e691a..51385509bba 100644 --- a/src/backend/regex/regcomp.c +++ b/src/backend/regex/regcomp.c @@ -257,7 +257,7 @@ struct vars /* parsing macros; most know that `v' is the struct vars pointer */ #define NEXT() (next(v)) /* advance by one token */ #define SEE(t) (v->nexttype == (t)) /* is next token this? */ -#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */ +#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */ #define VISERR(vv) ((vv)->err != 0) /* have we seen an error yet? */ #define ISERR() VISERR(v) #define VERR(vv,e) ((vv)->nexttype = EOS, \ @@ -942,7 +942,7 @@ parseqatom(struct vars *v, assert((size_t) subno < v->nsubs); } else - atomtype = PLAIN; /* something that's not '(' */ + atomtype = PLAIN; /* something that's not '(' */ NEXT(); /* need new endpoints because tree will contain pointers */ s = newstate(v->nfa); @@ -1124,7 +1124,7 @@ parseqatom(struct vars *v, /* if it's a backref, now is the time to replicate the subNFA */ if (atomtype == BACKREF) { - assert(atom->begin->nouts == 1); /* just the EMPTY */ + assert(atom->begin->nouts == 1); /* just the EMPTY */ delsub(v->nfa, atom->begin, atom->end); assert(v->subs[subno] != NULL); @@ -1145,7 +1145,7 @@ parseqatom(struct vars *v, if (atomtype == BACKREF) { /* special case: backrefs have internal quantifiers */ - EMPTYARC(s, atom->begin); /* empty prefix */ + EMPTYARC(s, atom->begin); /* empty prefix */ /* just stuff everything into atom */ repeat(v, atom->begin, atom->end, m, n); atom->min = (short) m; @@ -1157,7 +1157,7 @@ parseqatom(struct vars *v, else if (m == 1 && n == 1) { /* no/vacuous quantifier: done */ - EMPTYARC(s, atom->begin); /* empty prefix */ + EMPTYARC(s, atom->begin); /* empty prefix */ /* rest of branch can be strung starting from atom->end */ s2 = atom->end; } @@ -1175,7 +1175,7 @@ parseqatom(struct vars *v, assert(m >= 1 && m != DUPINF && n >= 1); repeat(v, s, atom->begin, m - 1, (n == DUPINF) ? n : n - 1); f = COMBINE(qprefer, atom->flags); - t = subre(v, '.', f, s, atom->end); /* prefix and atom */ + t = subre(v, '.', f, s, atom->end); /* prefix and atom */ NOERR(); t->left = subre(v, '=', PREF(f), s, atom->begin); NOERR(); @@ -1618,7 +1618,7 @@ wordchrs(struct vars *v) */ static void processlacon(struct vars *v, - struct state *begin, /* start of parsed LACON sub-re */ + struct state *begin, /* start of parsed LACON sub-re */ struct state *end, /* end of parsed LACON sub-re */ int latype, struct state *lp, /* left state to hang it on */ @@ -2180,7 +2180,7 @@ stid(struct subre *t, sprintf(buf, "%p", t); return buf; } -#endif /* REG_DEBUG */ +#endif /* REG_DEBUG */ #include "regc_lex.c" |