diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-09-16 15:25:25 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-09-16 15:25:25 -0400 |
commit | b44d92b67b65a76f92448b5a282aae72820ac676 (patch) | |
tree | 87c231de73f255181c2a96795617638c4b7b1b44 /src/backend/regex/regcomp.c | |
parent | d0f18cde7e40f1f6412bb35e8645888cd620682f (diff) | |
download | postgresql-b44d92b67b65a76f92448b5a282aae72820ac676.tar.gz postgresql-b44d92b67b65a76f92448b5a282aae72820ac676.zip |
Sync regex code with Tcl 8.6.4.
Sync our regex code with upstream changes since last time we did this,
which was Tcl 8.5.11 (see commit 08fd6ff37f71485e2fc04bc6ce07d2a483c36702).
The only functional change here is to disbelieve that an octal escape is
three digits long if it would exceed \377. That's a bug fix, but it's
a minor one and could change the interpretation of working regexes, so
don't back-patch.
In addition to that, s/INFINITY/DUPINF/ to eliminate the risk of collisions
with <math.h>'s macro, and s/LOCAL/NOPROP/ because that also seems like
an unnecessarily collision-prone macro name.
There were some other cosmetic changes in their copy that I did not adopt,
notably a rather half-hearted attempt at renaming some of the C functions
in a more verbose style. (I'm not necessarily against the concept, but
renaming just a few functions in the package is not an improvement.)
Diffstat (limited to 'src/backend/regex/regcomp.c')
-rw-r--r-- | src/backend/regex/regcomp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c index 44a472fa69e..6b95975f2be 100644 --- a/src/backend/regex/regcomp.c +++ b/src/backend/regex/regcomp.c @@ -960,13 +960,13 @@ parseqatom(struct vars * v, { case '*': m = 0; - n = INFINITY; + n = DUPINF; qprefer = (v->nextvalue) ? LONGER : SHORTER; NEXT(); break; case '+': m = 1; - n = INFINITY; + n = DUPINF; qprefer = (v->nextvalue) ? LONGER : SHORTER; NEXT(); break; @@ -984,7 +984,7 @@ parseqatom(struct vars * v, if (SEE(DIGIT)) n = scannum(v); else - n = INFINITY; + n = DUPINF; if (m > n) { ERR(REG_BADBR); @@ -1146,8 +1146,8 @@ parseqatom(struct vars * v, * really care where its submatches are. */ dupnfa(v->nfa, atom->begin, atom->end, s, atom->begin); - assert(m >= 1 && m != INFINITY && n >= 1); - repeat(v, s, atom->begin, m - 1, (n == INFINITY) ? n : n - 1); + 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 */ NOERR(); @@ -1268,7 +1268,7 @@ repeat(struct vars * v, #define SOME 2 #define INF 3 #define PAIR(x, y) ((x)*4 + (y)) -#define REDUCE(x) ( ((x) == INFINITY) ? INF : (((x) > 1) ? SOME : (x)) ) +#define REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (x)) ) const int rm = REDUCE(m); const int rn = REDUCE(n); struct state *s; @@ -2026,7 +2026,7 @@ stdump(struct subre * t, if (t->min != 1 || t->max != 1) { fprintf(f, " {%d,", t->min); - if (t->max != INFINITY) + if (t->max != DUPINF) fprintf(f, "%d", t->max); fprintf(f, "}"); } |