aboutsummaryrefslogtreecommitdiff
path: root/src/backend/regex/regc_lex.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-02-14 17:33:37 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-02-14 17:33:37 +0000
commitdf1e965e12cdd48c11057ee6e15346ee2b8b02f5 (patch)
treeca6644f5fc9e7b0c6d21432cddbe90d7ac8ddd14 /src/backend/regex/regc_lex.c
parent423abf4d6aef113501c880edd3e41975860f2a31 (diff)
downloadpostgresql-df1e965e12cdd48c11057ee6e15346ee2b8b02f5.tar.gz
postgresql-df1e965e12cdd48c11057ee6e15346ee2b8b02f5.zip
Sync our regex code with upstream changes since last time we did this, which
was Tcl 8.4.8. The main changes are to remove the never-fully-implemented code for multi-character collating elements, and to const-ify some stuff a bit more fully. In combination with the recent security patch, this commit brings us into line with Tcl 8.5.0. Note that I didn't make any effort to duplicate a lot of cosmetic changes that they made to bring their copy into line with their own style guidelines, such as adding braces around single-line IF bodies. Most of those we either had done already (such as ANSI-fication of function headers) or there is no point because pgindent would undo the change anyway.
Diffstat (limited to 'src/backend/regex/regc_lex.c')
-rw-r--r--src/backend/regex/regc_lex.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c
index fc86ca322a9..d2fc591ed8a 100644
--- a/src/backend/regex/regc_lex.c
+++ b/src/backend/regex/regc_lex.c
@@ -28,7 +28,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/src/backend/regex/regc_lex.c,v 1.7 2008/01/03 20:47:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_lex.c,v 1.8 2008/02/14 17:33:37 tgl Exp $
*
*/
@@ -201,8 +201,8 @@ prefixes(struct vars * v)
*/
static void
lexnest(struct vars * v,
- chr *beginp, /* start of interpolation */
- chr *endp) /* one past end of interpolation */
+ const chr *beginp, /* start of interpolation */
+ const chr *endp) /* one past end of interpolation */
{
assert(v->savenow == NULL); /* only one level of nesting */
v->savenow = v->now;
@@ -214,47 +214,47 @@ lexnest(struct vars * v,
/*
* string constants to interpolate as expansions of things like \d
*/
-static chr backd[] = { /* \d */
+static const chr backd[] = { /* \d */
CHR('['), CHR('['), CHR(':'),
CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'),
CHR(':'), CHR(']'), CHR(']')
};
-static chr backD[] = { /* \D */
+static const chr backD[] = { /* \D */
CHR('['), CHR('^'), CHR('['), CHR(':'),
CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'),
CHR(':'), CHR(']'), CHR(']')
};
-static chr brbackd[] = { /* \d within brackets */
+static const chr brbackd[] = { /* \d within brackets */
CHR('['), CHR(':'),
CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'),
CHR(':'), CHR(']')
};
-static chr backs[] = { /* \s */
+static const chr backs[] = { /* \s */
CHR('['), CHR('['), CHR(':'),
CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'),
CHR(':'), CHR(']'), CHR(']')
};
-static chr backS[] = { /* \S */
+static const chr backS[] = { /* \S */
CHR('['), CHR('^'), CHR('['), CHR(':'),
CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'),
CHR(':'), CHR(']'), CHR(']')
};
-static chr brbacks[] = { /* \s within brackets */
+static const chr brbacks[] = { /* \s within brackets */
CHR('['), CHR(':'),
CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'),
CHR(':'), CHR(']')
};
-static chr backw[] = { /* \w */
+static const chr backw[] = { /* \w */
CHR('['), CHR('['), CHR(':'),
CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'),
CHR(':'), CHR(']'), CHR('_'), CHR(']')
};
-static chr backW[] = { /* \W */
+static const chr backW[] = { /* \W */
CHR('['), CHR('^'), CHR('['), CHR(':'),
CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'),
CHR(':'), CHR(']'), CHR('_'), CHR(']')
};
-static chr brbackw[] = { /* \w within brackets */
+static const chr brbackw[] = { /* \w within brackets */
CHR('['), CHR(':'),
CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'),
CHR(':'), CHR(']'), CHR('_')
@@ -722,7 +722,7 @@ lexescape(struct vars * v)
static chr esc[] = {
CHR('E'), CHR('S'), CHR('C')
};
- chr *save;
+ const chr *save;
assert(v->cflags & REG_ADVF);
@@ -1080,7 +1080,7 @@ brenext(struct vars * v,
static void
skip(struct vars * v)
{
- chr *start = v->now;
+ const chr *start = v->now;
assert(v->cflags & REG_EXPANDED);
@@ -1119,8 +1119,8 @@ newline(void)
*/
static chr
chrnamed(struct vars * v,
- chr *startp, /* start of name */
- chr *endp, /* just past end of name */
+ const chr *startp, /* start of name */
+ const chr *endp, /* just past end of name */
chr lastresort) /* what to return if name lookup fails */
{
celt c;