diff options
author | nigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-02-24 21:38:09 +0000 |
---|---|---|
committer | nigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-02-24 21:38:09 +0000 |
commit | 94ffc03e8ac1628911f231a91d7d8d94c2f0dc38 (patch) | |
tree | 29906e1897834846e4d630ac09285b27656f2cdc | |
parent | e390bd8b72ea8a359349a0d3ec2061289dc65b56 (diff) | |
download | pcre-94ffc03e8ac1628911f231a91d7d8d94c2f0dc38.tar.gz |
Load pcre-1.02 into code/trunk.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@7 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile | 25 | ||||
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | internal.h | 7 | ||||
-rw-r--r-- | pcre.3 | 6 | ||||
-rw-r--r-- | pcre.c | 114 | ||||
-rw-r--r-- | pcre.h | 6 | ||||
-rw-r--r-- | pcreposix.c | 32 | ||||
-rw-r--r-- | pcretest.c | 9 | ||||
-rw-r--r-- | pgrep.c | 2 | ||||
-rw-r--r-- | study.c | 8 | ||||
-rw-r--r-- | testoutput | 2 | ||||
-rw-r--r-- | testoutput2 | 2 |
13 files changed, 131 insertions, 107 deletions
@@ -2,6 +2,20 @@ ChangeLog for PCRE ------------------ +Version 1.02 12-Dec-97 +---------------------- + +1. Typos in pcre.3 and comments in the source fixed. + +2. Applied a contributed patch to get rid of places where it used to remove +'const' from variables, and fixed some signed/unsigned and uninitialized +variable warnings. + +3. Added the "runtest" target to Makefile. + +4. Set default compiler flag to -O2 rather than just -O. + + Version 1.01 19-Nov-97 ---------------------- @@ -1,6 +1,6 @@ # Make file for PCRE (Perl-Compatible Regular Expression) library. -# Edit CC , CFLAGS, and RANLIB for your system. +# Edit CC, CFLAGS, and RANLIB for your system. # It is believed that RANLIB=ranlib is required for AIX, BSDI, FreeBSD, Linux, # MIPS RISCOS, NetBSD, OpenBSD, Digital Unix, and Ultrix. @@ -12,7 +12,7 @@ # lacks the strerror() function, but can provide the equivalent by indexing # into errlist. -CC = gcc -O +CC = gcc -O2 CFLAGS = RANLIB = @true @@ -38,22 +38,22 @@ libpcreposix.a: pcreposix.o ar cq libpcreposix.a pcreposix.o $(RANLIB) libpcreposix.a -pcre.o: pcre.c pcre.h internal.h +pcre.o: pcre.c pcre.h internal.h Makefile $(CC) -c $(CFLAGS) pcre.c -pcreposix.o: pcreposix.c pcreposix.h internal.h +pcreposix.o: pcreposix.c pcreposix.h internal.h Makefile $(CC) -c $(CFLAGS) pcreposix.c chartables.o: chartables.c $(CC) -c $(CFLAGS) chartables.c -study.o: study.c pcre.h internal.h +study.o: study.c pcre.h internal.h Makefile $(CC) -c $(CFLAGS) study.c -pcretest.o: pcretest.c pcre.h +pcretest.o: pcretest.c pcre.h Makefile $(CC) -c $(CFLAGS) pcretest.c -pgrep.o: pgrep.c pcre.h +pgrep.o: pgrep.c pcre.h Makefile $(CC) -c $(CFLAGS) pgrep.c # An auxiliary program makes the character tables @@ -61,7 +61,7 @@ pgrep.o: pgrep.c pcre.h chartables.c: maketables ./maketables >chartables.c -maketables: maketables.c +maketables: maketables.c Makefile $(CC) -o maketables $(CFLAGS) maketables.c # We deliberately omit maketables and chartables.c from 'make clean'; once made @@ -70,4 +70,13 @@ maketables: maketables.c clean:; /bin/rm -f *.o *.a pcretest pgrep +# Run the tests + +runtest: all + ./pcretest testinput testtry + diff testtry testoutput + ./pcretest -i testinput2 testtry + diff testtry testoutput2 + rm -f testtry + # End @@ -33,14 +33,17 @@ a test program called pcretest, and the pgrep command. To test PCRE, run pcretest on the file testinput, and compare the output with the contents of testoutput. There should be no differences. For example: - pcretest testinput /tmp/anything - diff /tmp/anything testoutput + pcretest testinput some.file + diff some.file testoutput Do the same with testinput2, comparing the output with testoutput2, but this time using the -i flag for pcretest, i.e. - pcretest -i testinput2 /tmp/anything - diff /tmp/anything testoutput2 + pcretest -i testinput2 some.file + diff some.file testoutput2 + +The make target "runtest" runs both these tests, using the file "testtry" to +store the intermediate output, deleting it at the end if all goes well. There are two sets of tests because the first set can also be fed directly into the perltest program to check that Perl gives the same results. The second set @@ -3,7 +3,7 @@ *************************************************/ -#define PCRE_VERSION "1.01 19-Nov-1997" +#define PCRE_VERSION "1.02 12-Dec-1997" /* This is a library of functions to support regular expressions whose syntax @@ -108,7 +108,7 @@ enum { ESC_A = 1, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w, /* Opcode table: OP_BRA must be last, as all values >= it are used for brackets that extract substrings. Starting from 1 (i.e. after OP_END), the values up to -OP_EOL must correspond in order to the list of escapes immediately above. */ +OP_EOD must correspond in order to the list of escapes immediately above. */ enum { OP_END, /* End of pattern */ @@ -125,8 +125,7 @@ enum { OP_NOT_WORDCHAR, /* \W */ OP_WORDCHAR, /* \w */ OP_CUT, /* The analogue of Prolog's "cut" operation (extension) */ - OP_EOD, /* End of data: or \Z. This must always be the last - of the backslashed meta values. */ + OP_EOD, /* End of data: \Z. */ OP_CIRC, /* Start of line - varies with multiline switch */ OP_DOLL, /* End of line - varies with multiline switch */ @@ -603,8 +603,8 @@ operation from backtracking past it. For example, if the expression .*/foo -is matched against the string "/foo/this/is/not" then after the initial greedy -.* has swallowed the whole string, it keeps backtracking right the way to the +is matched against the string "/foo/this/is/not" then after the greedy .* +has swallowed the whole string, PCRE keeps backtracking all the way to the beginning before failing. If, on the other hand, the expression is .*/\\Xfoo @@ -866,7 +866,7 @@ own right. Because it has two uses, it can sometimes appear doubled, as in which matches one digit by preference, but can match two if that is the only way the rest of the pattern matches. -When a parenthesized subpattern is quantified a with minimum repeat count that +When a parenthesized subpattern is quantified with a minimum repeat count that is greater than 1 or with a limited maximum, more store is required for the compiled pattern, in proportion to the size of the minimum or maximum. @@ -48,7 +48,8 @@ static char rep_max[] = { 0, 0, 0, 0, 1, 1 }; /* Text forms of OP_ values and things, for debugging */ #ifdef DEBUG -static char *OP_names[] = { "End", "\\A", "\\B", "\\b", "\\D", "\\d", +static const char *OP_names[] = { + "End", "\\A", "\\B", "\\b", "\\D", "\\d", "\\S", "\\s", "\\W", "\\w", "Cut", "\\Z", "^", "$", "Any", "chars", "not", "*", "*?", "+", "+?", "?", "??", "{", "{", "{", @@ -81,7 +82,7 @@ static short int escapes[] = { /* Definition to allow mutual recursion */ -static BOOL compile_regex(int, int *,uschar **,uschar **,char **); +static BOOL compile_regex(int, int *, uschar **, const uschar **, const char **); /* Structure for passing "static" information around between the functions doing the matching, so that they are thread-safe. */ @@ -98,10 +99,10 @@ typedef struct match_data { BOOL noteol; /* NOTEOL flag */ BOOL dotall; /* Dot matches any char */ BOOL endonly; /* Dollar not before final \n */ - uschar *start_subject; /* Start of the subject string */ - uschar *end_subject; /* End of the subject string */ + const uschar *start_subject; /* Start of the subject string */ + const uschar *end_subject; /* End of the subject string */ jmp_buf fail_env; /* Environment for longjump() break out */ - uschar *end_match_ptr; /* Subject position at end match */ + const uschar *end_match_ptr; /* Subject position at end match */ int end_offset_top; /* Highwater mark at end of match */ } match_data; @@ -126,7 +127,7 @@ void (*pcre_free)(void *) = free; * Return version string * *************************************************/ -char * +const char * pcre_version(void) { return PCRE_VERSION; @@ -156,7 +157,7 @@ Returns: number of identifying extraction brackets int pcre_info(const pcre *external_re, int *optptr, int *first_char) { -real_pcre *re = (real_pcre *)external_re; +const real_pcre *re = (const real_pcre *)external_re; if (re == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (optptr != NULL) *optptr = (re->options & PUBLIC_OPTIONS); @@ -360,10 +361,10 @@ Returns: zero or positive => a data character */ static int -check_escape(uschar **ptrptr, char **errorptr, int bracount, int options, - BOOL isclass) +check_escape(const uschar **ptrptr, const char **errorptr, int bracount, + int options, BOOL isclass) { -uschar *ptr = *ptrptr; +const uschar *ptr = *ptrptr; int c = *(++ptr) & 255; /* Ensure > 0 on signed-char systems */ int i; @@ -382,7 +383,7 @@ else if ((i = escapes[c - '0']) != 0) c = i; else { - uschar *oldptr; + const uschar *oldptr; switch (c) { /* The handling of escape sequences consisting of a string of digits @@ -502,7 +503,7 @@ Returns: TRUE or FALSE */ static BOOL -is_counted_repeat(uschar *p) +is_counted_repeat(const uschar *p) { if ((pcre_ctypes[*p++] & ctype_digit) == 0) return FALSE; while ((pcre_ctypes[*p] & ctype_digit) != 0) p++; @@ -537,8 +538,8 @@ Returns: pointer to '}' on success; current ptr on error, with errorptr set */ -static uschar * -read_repeat_counts(uschar *p, int *minp, int *maxp, char **errorptr) +static const uschar * +read_repeat_counts(const uschar *p, int *minp, int *maxp, const char **errorptr) { int min = 0; int max = -1; @@ -592,17 +593,17 @@ Returns: TRUE on success */ static BOOL -compile_branch(int options, int *brackets, uschar **codeptr, uschar **ptrptr, - char **errorptr) +compile_branch(int options, int *brackets, uschar **codeptr, + const uschar **ptrptr, const char **errorptr) { int repeat_type, op_type; int repeat_min, repeat_max; int bravalue, length; register int c; register uschar *code = *codeptr; -uschar *ptr = *ptrptr; +const uschar *ptr = *ptrptr; +const uschar *oldptr; uschar *previous = NULL; -uschar *oldptr; uschar class[32]; /* Switch on next character until the end of the branch */ @@ -697,7 +698,7 @@ for (;; ptr++) /* Backslash may introduce a single character, or it may introduce one of the specials, which just set a flag. Escaped items are checked for validity in the pre-compiling pass. The sequence \b is a special case. - Inside a class (and only there) it is treated as backslash. Elsewhere + Inside a class (and only there) it is treated as backspace. Elsewhere it marks a word boundary. Other escapes have preset maps ready to or into the one we are building. We assume they have more than one character in them, so set class_count bigger than one. */ @@ -1214,7 +1215,7 @@ for (;; ptr++) continue; } - /* Reset and fall through */ + /* Data character: reset and fall through */ ptr = oldptr; c = '\\'; @@ -1305,10 +1306,10 @@ Returns: TRUE on success */ static BOOL -compile_regex(int options, int *brackets, uschar **codeptr, uschar **ptrptr, - char **errorptr) +compile_regex(int options, int *brackets, uschar **codeptr, + const uschar **ptrptr, const char **errorptr) { -uschar *ptr = *ptrptr; +const uschar *ptr = *ptrptr; uschar *code = *codeptr; uschar *start_bracket = code; @@ -1374,7 +1375,7 @@ Returns: TRUE or FALSE */ static BOOL -is_anchored(register uschar *code, BOOL multiline) +is_anchored(register const uschar *code, BOOL multiline) { do { int op = (int)code[3]; @@ -1403,7 +1404,7 @@ Returns: TRUE or FALSE */ static BOOL -is_startline(uschar *code) +is_startline(const uschar *code) { do { if ((int)code[3] >= OP_BRA || code[3] == OP_ASSERT) @@ -1488,7 +1489,7 @@ Returns: pointer to compiled data block, or NULL on error, */ pcre * -pcre_compile(const char *pattern, int options, char **errorptr, +pcre_compile(const char *pattern, int options, const char **errorptr, int *erroroffset) { real_pcre *re; @@ -1498,9 +1499,10 @@ int runlength; int c, size; int bracount = 0; int brastack[200]; -int brastackptr = 0; int top_backref = 0; -uschar *code, *ptr; +unsigned int brastackptr = 0; +uschar *code; +const uschar *ptr; #ifdef DEBUG uschar *code_base, *code_end; @@ -1539,7 +1541,7 @@ internal flag settings. Make an attempt to correct for any counted white space if an "extended" flag setting appears late in the pattern. We can't be so clever for #-comments. */ -ptr = (uschar *)(pattern - 1); +ptr = (const uschar *)(pattern - 1); while ((c = *(++ptr)) != 0) { int min, max; @@ -1566,7 +1568,7 @@ while ((c = *(++ptr)) != 0) case '\\': { - uschar *save_ptr = ptr; + const uschar *save_ptr = ptr; c = check_escape(&ptr, errorptr, bracount, options, FALSE); if (*errorptr != NULL) goto PCRE_ERROR_RETURN; if (c >= 0) @@ -1831,7 +1833,7 @@ while ((c = *(++ptr)) != 0) if (c == '\\') { - uschar *saveptr = ptr; + const uschar *saveptr = ptr; c = check_escape(&ptr, errorptr, bracount, options, FALSE); if (*errorptr != NULL) goto PCRE_ERROR_RETURN; if (c < 0) { ptr = saveptr; break; } @@ -1879,7 +1881,7 @@ re->options = options; error, *errorptr will be set non-NULL, so we don't need to look at the result of the function here. */ -ptr = (uschar *)pattern; +ptr = (const uschar *)pattern; code = re->code; *code = OP_BRA; bracount = 0; @@ -1906,7 +1908,7 @@ if (*errorptr != NULL) { (pcre_free)(re); PCRE_ERROR_RETURN: - *erroroffset = ptr - (uschar *)pattern; + *erroroffset = ptr - (const uschar *)pattern; return NULL; } @@ -2204,9 +2206,9 @@ Returns: TRUE if matched */ static BOOL -match_ref(int number, register uschar *eptr, int length, match_data *md) +match_ref(int number, register const uschar *eptr, int length, match_data *md) { -uschar *p = md->start_subject + md->offset_vector[number]; +const uschar *p = md->start_subject + md->offset_vector[number]; #ifdef DEBUG if (eptr >= md->end_subject) @@ -2253,7 +2255,7 @@ Returns: TRUE if matched */ static BOOL -match(register uschar *eptr, register uschar *ecode, int offset_top, +match(register const uschar *eptr, register const uschar *ecode, int offset_top, match_data *md) { for (;;) @@ -2261,7 +2263,7 @@ for (;;) int min, max, ctype; register int i; register int c; - BOOL minimize; + BOOL minimize = FALSE; /* Opening bracket. Check the alternative branches in turn, failing if none match. We have to set the start offset if required and there is space @@ -2274,7 +2276,7 @@ for (;;) if ((int)*ecode >= OP_BRA) { int number = (*ecode - OP_BRA) << 1; - int save_offset1, save_offset2; + int save_offset1 = 0, save_offset2 = 0; #ifdef DEBUG printf("start bracket %d\n", number/2); @@ -2401,7 +2403,7 @@ for (;;) case OP_BRAZERO: { - uschar *next = ecode+1; + const uschar *next = ecode+1; if (match(eptr, next, offset_top, md)) return TRUE; do next += (next[1] << 8) + next[2]; while (*next == OP_ALT); ecode = next + 3; @@ -2410,7 +2412,7 @@ for (;;) case OP_BRAMINZERO: { - uschar *next = ecode+1; + const uschar *next = ecode+1; do next += (next[1] << 8) + next[2]; while (*next == OP_ALT); if (match(eptr, next+3, offset_top, md)) return TRUE; ecode++; @@ -2426,7 +2428,7 @@ for (;;) case OP_KETRMAX: { int number; - uschar *prev = ecode - (ecode[1] << 8) - ecode[2]; + const uschar *prev = ecode - (ecode[1] << 8) - ecode[2]; if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT || *prev == OP_ONCE) { @@ -2675,7 +2677,7 @@ for (;;) else { - uschar *pp = eptr; + const uschar *pp = eptr; for (i = min; i < max; i++) { if (!match_ref(number, eptr, length, md)) break; @@ -2699,8 +2701,8 @@ for (;;) case OP_CLASS: { - uschar *data = ecode + 1; /* Save for matching */ - ecode += 33; /* Advance past the item */ + const uschar *data = ecode + 1; /* Save for matching */ + ecode += 33; /* Advance past the item */ switch (*ecode) { @@ -2783,7 +2785,7 @@ for (;;) else { - uschar *pp = eptr; + const uschar *pp = eptr; for (i = min; i < max; eptr++, i++) { if (eptr >= md->end_subject) break; @@ -2901,7 +2903,7 @@ for (;;) } else { - uschar *pp = eptr; + const uschar *pp = eptr; for (i = min; i < max; i++) { if (eptr >= md->end_subject || c != pcre_lcc[*eptr]) break; @@ -2931,7 +2933,7 @@ for (;;) } else { - uschar *pp = eptr; + const uschar *pp = eptr; for (i = min; i < max; i++) { if (eptr >= md->end_subject || c != *eptr) break; @@ -3028,7 +3030,7 @@ for (;;) } else { - uschar *pp = eptr; + const uschar *pp = eptr; for (i = min; i < max; i++) { if (eptr >= md->end_subject || c == pcre_lcc[*eptr]) break; @@ -3058,7 +3060,7 @@ for (;;) } else { - uschar *pp = eptr; + const uschar *pp = eptr; for (i = min; i < max; i++) { if (eptr >= md->end_subject || c == *eptr) break; @@ -3175,7 +3177,7 @@ for (;;) else { - uschar *pp = eptr; + const uschar *pp = eptr; switch(ctype) { case OP_ANY: @@ -3307,11 +3309,11 @@ int resetcount; int ocount = offsetcount; int first_char = -1; match_data match_block; -uschar *start_bits = NULL; -uschar *start_match = (uschar *)subject; -uschar *end_subject; -real_pcre *re = (real_pcre *)external_re; -real_pcre_extra *extra = (real_pcre_extra *)external_extra; +const uschar *start_bits = NULL; +const uschar *start_match = (uschar *)subject; +const uschar *end_subject; +const real_pcre *re = (const real_pcre *)external_re; +const real_pcre_extra *extra = (const real_pcre_extra *)external_extra; BOOL anchored = ((re->options | options) & PCRE_ANCHORED) != 0; BOOL startline = (re->options & PCRE_STARTLINE) != 0; @@ -3321,7 +3323,7 @@ if (re == NULL || subject == NULL || (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; -match_block.start_subject = (uschar *)subject; +match_block.start_subject = (const uschar *)subject; match_block.end_subject = match_block.start_subject + length; end_subject = match_block.end_subject; @@ -47,11 +47,11 @@ extern void (*pcre_free)(void *); /* Functions */ -extern pcre *pcre_compile(const char *, int, char **, int *); +extern pcre *pcre_compile(const char *, int, const char **, int *); extern int pcre_exec(const pcre *, const pcre_extra *, const char *, int, int, int *, int); extern int pcre_info(const pcre *, int *, int *); -extern pcre_extra *pcre_study(const pcre *, int, char **); -extern char *pcre_version(void); +extern pcre_extra *pcre_study(const pcre *, int, const char **); +extern const char *pcre_version(void); #endif /* End of pcre.h */ diff --git a/pcreposix.c b/pcreposix.c index 1fbd9ac..00f9dc7 100644 --- a/pcreposix.c +++ b/pcreposix.c @@ -39,7 +39,7 @@ restrictions: /* Corresponding tables of PCRE error messages and POSIX error codes. */ -static char *estring[] = { +static const char *estring[] = { ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20, ERR21, ERR22, ERR23 }; @@ -72,7 +72,7 @@ static int eint[] = { /* Table of texts corresponding to POSIX error codes */ -static char *pstring[] = { +static const char *pstring[] = { "", /* Dummy for value 0 */ "internal error", /* REG_ASSERT */ "invalid repeat counts in {}", /* BADBR */ @@ -106,7 +106,7 @@ look them up in a table to turn them into POSIX-style error codes. */ static int pcre_posix_error_code(const char *s) { -int i; +size_t i; for (i = 0; i < sizeof(estring)/sizeof(char *); i++) if (strcmp(s, estring[i]) == 0) return eint[i]; return REG_ASSERT; @@ -121,24 +121,20 @@ return REG_ASSERT; size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { -char *message, *addmessage; -int length, adlength; +const char *message, *addmessage; +size_t length, addlength; -message = (errcode >= sizeof(pstring)/sizeof(char *))? +message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))? "unknown error code" : pstring[errcode]; +length = strlen(message) + 1; -length = (int)strlen(message) + 1; - -if (preg != NULL && (int)preg->re_erroffset != -1) - { - addmessage = " at offset "; - adlength = (int)strlen(addmessage) + 6; - } -else adlength = 0; +addmessage = " at offset "; +addlength = (preg != NULL && (int)preg->re_erroffset != -1)? + strlen(addmessage) + 6 : 0; if (errbuf_size > 0) { - if (adlength > 0 && errbuf_size >= length + adlength) + if (addlength > 0 && errbuf_size >= length + addlength) sprintf(errbuf, "%s%s%-6d", message, addmessage, preg->re_erroffset); else { @@ -147,7 +143,7 @@ if (errbuf_size > 0) } } -return length + adlength; +return length + addlength; } @@ -183,7 +179,7 @@ Returns: 0 on success int regcomp(regex_t *preg, const char *pattern, int cflags) { -char *errorptr; +const char *errorptr; int erroffset; int options = 0; @@ -225,7 +221,7 @@ if (rc == 0) return 0; /* All pmatch were filled in */ if (rc > 0) { - int i; + size_t i; for (i = rc; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1; return 0; } @@ -30,7 +30,8 @@ static int log_store = 0; /* Debugging function to print the internal form of the regex. This is the same code as contained in pcre.c under the DEBUG macro. */ -static char *OP_names[] = { "End", "\\A", "\\B", "\\b", "\\D", "\\d", +static const char *OP_names[] = { + "End", "\\A", "\\B", "\\b", "\\D", "\\d", "\\S", "\\s", "\\W", "\\w", "Cut", "\\Z", "^", "$", "Any", "chars", "not", "*", "*?", "+", "+?", "?", "??", "{", "{", "{", @@ -327,7 +328,7 @@ for (;;) pcre *re = NULL; pcre_extra *extra = NULL; regex_t preg; - char *error; + const char *error; unsigned char *p, *pp; int do_study = 0; int do_debug = 0; @@ -661,7 +662,7 @@ for (;;) case 'O': while(isdigit(*p)) n = n * 10 + *p++ - '0'; - if (n <= sizeof(offsets)/sizeof(int)) size_offsets = n; + if (n <= (int)sizeof(offsets)/sizeof(int)) size_offsets = n; continue; case 'Z': @@ -694,7 +695,7 @@ for (;;) } else { - int i; + size_t i; for (i = 0; i < sizeof(pmatch)/sizeof(regmatch_t); i++) { if (pmatch[i].rm_so >= 0) @@ -137,7 +137,7 @@ int i; int rc = 1; int options = 0; int errptr; -char *error; +const char *error; BOOL filenames = TRUE; /* Process the options */ @@ -52,13 +52,13 @@ Returns: TRUE if table built, FALSE otherwise */ static BOOL -set_start_bits(uschar *code, uschar *start_bits) +set_start_bits(const uschar *code, uschar *start_bits) { register int c; do { - uschar *tcode = code + 3; + const uschar *tcode = code + 3; BOOL try_next = TRUE; while (try_next) @@ -264,12 +264,12 @@ Returns: pointer to a pcre_extra block, */ pcre_extra * -pcre_study(const pcre *external_re, int options, char **errorptr) +pcre_study(const pcre *external_re, int options, const char **errorptr) { BOOL caseless; uschar start_bits[32]; real_pcre_extra *extra; -real_pcre *re = (real_pcre *)external_re; +const real_pcre *re = (const real_pcre *)external_re; *errorptr = NULL; @@ -1,5 +1,5 @@ Testing Perl-Compatible Regular Expressions -PCRE version 1.01 19-Nov-1997 +PCRE version 1.02 12-Dec-1997 /the quick brown fox/ the quick brown fox diff --git a/testoutput2 b/testoutput2 index 872b73f..4034a2e 100644 --- a/testoutput2 +++ b/testoutput2 @@ -1,5 +1,5 @@ Testing Perl-Compatible Regular Expressions -PCRE version 1.01 19-Nov-1997 +PCRE version 1.02 12-Dec-1997 /(a)b|/ Identifying subpattern count = 1 |