--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -, +, @@ srclib/pcre/dftables.c srclib/pcre/get.c srclib/pcre/internal.h srclib/pcre/maketables.c srclib/pcre/pcre.c srclib/pcre/pcre.def srclib/pcre/pcre.hw srclib/pcre/pcre.in srclib/pcre/pcredemo.c srclib/pcre/pcregrep.c srclib/pcre/pcreposix.c srclib/pcre/pcreposix.h srclib/pcre/pcretest.c srclib/pcre/pgrep.c srclib/pcre/study.c {arch}/apache2/apache2--dilinger/apache2--dilinger--2.0/dilinger@voxel.net--2004/patch-log/patch-10 ./srclib/pcre/RunTest.in --permissions 755 => --permissions 644 --- orig/apache2/server/util.c +++ mod/apache2/server/util.c @@ -289,16 +289,16 @@ } /* - * Here's a pool-based interface to POSIX regex's regcomp(). + * Here's a pool-based interface to POSIX regex's ap_pcreposix_regcomp(). * Note that we return regex_t instead of being passed one. * The reason is that if you use an already-used regex_t structure, * the memory that you've already allocated gets forgotten, and - * regfree() doesn't clear it. So we don't allow it. + * ap_pcreposix_regfree() doesn't clear it. So we don't allow it. */ static apr_status_t regex_cleanup(void *preg) { - regfree((regex_t *) preg); + ap_pcreposix_regfree((regex_t *) preg); return APR_SUCCESS; } @@ -307,7 +307,7 @@ { regex_t *preg = apr_palloc(p, sizeof(regex_t)); - if (regcomp(preg, pattern, cflags)) { + if (ap_pcreposix_regcomp(preg, pattern, cflags)) { return NULL; } @@ -319,7 +319,7 @@ AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg) { - regfree(reg); + ap_pcreposix_regfree(reg); apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup); } @@ -387,7 +387,7 @@ } /* - * Apache stub function for the regex libraries regexec() to make sure the + * Apache stub function for the regex libraries ap_pcreposix_regexec() to make sure the * whole regex(3) API is available through the Apache (exported) namespace. * This is especially important for the DSO situations of modules. * DO NOT MAKE A MACRO OUT OF THIS FUNCTION! @@ -395,13 +395,13 @@ AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { - return regexec(preg, string, nmatch, pmatch, eflags); + return ap_pcreposix_regexec(preg, string, nmatch, pmatch, eflags); } AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { - return regerror(errcode, preg, errbuf, errbuf_size); + return ap_pcreposix_regerror(errcode, preg, errbuf, errbuf_size); } --- orig/apache2/srclib/pcre/dftables.c +++ mod/apache2/srclib/pcre/dftables.c @@ -36,7 +36,7 @@ /* This is a support program to generate the file chartables.c, containing character tables of various kinds. They are built according to the default C -locale and used as the default tables by PCRE. Now that pcre_maketables is +locale and used as the default tables by PCRE. Now that ap_pcre_maketables is a function visible to the outside world, we make use of its code from here in order to be consistent. */ @@ -53,7 +53,7 @@ int main(void) { int i; -const unsigned char *tables = pcre_maketables(); +const unsigned char *tables = ap_pcre_maketables(); printf( "/*************************************************\n" --- orig/apache2/srclib/pcre/get.c +++ mod/apache2/srclib/pcre/get.c @@ -56,7 +56,7 @@ subject the subject string that was matched ovector pointer to the offsets table stringcount the number of substrings that were captured - (i.e. the yield of the pcre_exec call, unless + (i.e. the yield of the ap_pcre_exec call, unless that was zero, in which case it should be 1/3 of the offset table size) stringnumber the number of the required substring @@ -72,7 +72,7 @@ */ int -pcre_copy_substring(const char *subject, int *ovector, int stringcount, +ap_pcre_copy_substring(const char *subject, int *ovector, int stringcount, int stringnumber, char *buffer, int size) { int yield; @@ -99,7 +99,7 @@ subject the subject string that was matched ovector pointer to the offsets table stringcount the number of substrings that were captured - (i.e. the yield of the pcre_exec call, unless + (i.e. the yield of the ap_pcre_exec call, unless that was zero, in which case it should be 1/3 of the offset table size) listptr set to point to the list of pointers @@ -110,7 +110,7 @@ */ int -pcre_get_substring_list(const char *subject, int *ovector, int stringcount, +ap_pcre_get_substring_list(const char *subject, int *ovector, int stringcount, const char ***listptr) { int i; @@ -122,7 +122,7 @@ for (i = 0; i < double_count; i += 2) size += sizeof(char *) + ovector[i+1] - ovector[i] + 1; -stringlist = (char **)(pcre_malloc)(size); +stringlist = (char **)(ap_pcre_malloc)(size); if (stringlist == NULL) return PCRE_ERROR_NOMEMORY; *listptr = (const char **)stringlist; @@ -144,20 +144,20 @@ /************************************************* -* Free store obtained by get_substring_list * +* Free store obtained by ap_get_substring_list * *************************************************/ /* This function exists for the benefit of people calling PCRE from non-C -programs that can call its functions, but not free() or (pcre_free)() directly. +programs that can call its functions, but not free() or (ap_pcre_free)() directly. -Argument: the result of a previous pcre_get_substring_list() +Argument: the result of a previous ap_pcre_get_substring_list() Returns: nothing */ void -pcre_free_substring_list(const char **pointer) +ap_pcre_free_substring_list(const char **pointer) { -(pcre_free)((void *)pointer); +(ap_pcre_free)((void *)pointer); } @@ -173,7 +173,7 @@ subject the subject string that was matched ovector pointer to the offsets table stringcount the number of substrings that were captured - (i.e. the yield of the pcre_exec call, unless + (i.e. the yield of the ap_pcre_exec call, unless that was zero, in which case it should be 1/3 of the offset table size) stringnumber the number of the required substring @@ -188,7 +188,7 @@ */ int -pcre_get_substring(const char *subject, int *ovector, int stringcount, +ap_pcre_get_substring(const char *subject, int *ovector, int stringcount, int stringnumber, const char **stringptr) { int yield; @@ -197,7 +197,7 @@ return PCRE_ERROR_NOSUBSTRING; stringnumber *= 2; yield = ovector[stringnumber+1] - ovector[stringnumber]; -substring = (char *)(pcre_malloc)(yield + 1); +substring = (char *)(ap_pcre_malloc)(yield + 1); if (substring == NULL) return PCRE_ERROR_NOMEMORY; memcpy(substring, subject + ovector[stringnumber], yield); substring[yield] = 0; @@ -208,20 +208,20 @@ /************************************************* -* Free store obtained by get_substring * +* Free store obtained by ap_get_substring * *************************************************/ /* This function exists for the benefit of people calling PCRE from non-C -programs that can call its functions, but not free() or (pcre_free)() directly. +programs that can call its functions, but not free() or (ap_pcre_free)() directly. Argument: the result of a previous pcre_get_substring() Returns: nothing */ void -pcre_free_substring(const char *pointer) +ap_pcre_free_substring(const char *pointer) { -(pcre_free)((void *)pointer); +(ap_pcre_free)((void *)pointer); } /* End of get.c */ --- orig/apache2/srclib/pcre/internal.h +++ mod/apache2/srclib/pcre/internal.h @@ -96,7 +96,7 @@ #define PCRE_INGROUP 0x08000000 /* compiling inside a group */ #define PCRE_ICHANGED 0x04000000 /* i option changes within regex */ -/* Options for the "extra" block produced by pcre_study(). */ +/* Options for the "extra" block produced by ap_pcre_study(). */ #define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */ @@ -334,7 +334,7 @@ uschar code[1]; } real_pcre; -/* The real format of the extra block returned by pcre_study(). */ +/* The real format of the extra block returned by ap_pcre_study(). */ typedef struct real_pcre_extra { uschar options; --- orig/apache2/srclib/pcre/maketables.c +++ mod/apache2/srclib/pcre/maketables.c @@ -51,7 +51,7 @@ /* This function builds a set of character tables for use by PCRE and returns a pointer to them. They are build using the ctype functions, and consequently their contents will depend upon the current locale setting. When compiled as -part of the library, the store is obtained via pcre_malloc(), but when compiled +part of the library, the store is obtained via ap_pcre_malloc(), but when compiled inside dftables, use malloc(). Arguments: none @@ -59,13 +59,13 @@ */ const unsigned char * -pcre_maketables(void) +ap_pcre_maketables(void) { unsigned char *yield, *p; int i; #ifndef DFTABLES -yield = (unsigned char*)(pcre_malloc)(tables_length); +yield = (unsigned char*)(ap_pcre_malloc)(tables_length); #else yield = (unsigned char*)malloc(tables_length); #endif --- orig/apache2/srclib/pcre/pcre.c +++ mod/apache2/srclib/pcre/pcre.c @@ -184,8 +184,8 @@ indirections below, which are can be changed by the caller, but are shared between all threads. */ -void *(*pcre_malloc)(size_t) = malloc; -void (*pcre_free)(void *) = free; +void *(*ap_pcre_malloc)(size_t) = malloc; +void (*ap_pcre_free)(void *) = free; @@ -255,7 +255,7 @@ /* A default set of character tables is included in the PCRE binary. Its source is built by the maketables auxiliary program, which uses the default C ctypes functions, and put in the file chartables.c. These tables are used by PCRE -whenever the caller of pcre_compile() does not provide an alternate set of +whenever the caller of ap_pcre_compile() does not provide an alternate set of tables. */ #include "chartables.c" @@ -330,7 +330,7 @@ #define XSTRING(s) STRING(s) const char * -pcre_version(void) +ap_pcre_version(void) { return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE); } @@ -347,7 +347,7 @@ backwards compatibility. The public options are passed back in an int - though the re->options field has been expanded to a long int, all the public options at the low end of it, and so even on 16-bit systems this will still be OK. -Therefore, I haven't changed the API for pcre_info(). +Therefore, I haven't changed the API for ap_pcre_info(). Arguments: external_re points to compiled code @@ -361,7 +361,7 @@ */ int -pcre_info(const pcre *external_re, int *optptr, int *first_char) +ap_pcre_info(const pcre *external_re, int *optptr, int *first_char) { const real_pcre *re = (const real_pcre *)external_re; if (re == NULL) return PCRE_ERROR_NULL; @@ -392,7 +392,7 @@ */ int -pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what, +ap_pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; @@ -2475,7 +2475,7 @@ */ pcre * -pcre_compile(const char *pattern, int options, const char **errorptr, +ap_pcre_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables) { real_pcre *re; @@ -3052,7 +3052,7 @@ difference to the value of the offsetof(). */ size = length + offsetof(real_pcre, code[0]); -re = (real_pcre *)(pcre_malloc)(size); +re = (real_pcre *)(ap_pcre_malloc)(size); if (re == NULL) { @@ -3102,7 +3102,7 @@ if (*errorptr != NULL) { - (pcre_free)(re); + (ap_pcre_free)(re); PCRE_ERROR_RETURN: *erroroffset = ptr - (const uschar *)pattern; return NULL; @@ -3373,7 +3373,7 @@ if (code - re->code > length) { *errorptr = ERR23; - (pcre_free)(re); + (ap_pcre_free)(re); *erroroffset = ptr - (uschar *)pattern; return NULL; } @@ -3715,7 +3715,7 @@ if (c < 16) save = stacksave; else { - save = (int *)(pcre_malloc)((c+1) * sizeof(int)); + save = (int *)(ap_pcre_malloc)((c+1) * sizeof(int)); if (save == NULL) { save = stacksave; @@ -3729,7 +3729,7 @@ match_isgroup); for (i = 1; i <= c; i++) md->offset_vector[md->offset_end - i] = save[i]; - if (save != stacksave) (pcre_free)(save); + if (save != stacksave) (ap_pcre_free)(save); if (!rc) return FALSE; /* In case the recursion has set more capturing values, save the final @@ -4867,7 +4867,7 @@ Arguments: external_re points to the compiled expression - external_extra points to "hints" from pcre_study() or is NULL + external_extra points to "hints" from ap_pcre_study() or is NULL subject points to the subject string length length of subject string (may contain binary zeros) start_offset where to start in the subject string @@ -4882,7 +4882,7 @@ */ int -pcre_exec(const pcre *external_re, const pcre_extra *external_extra, +ap_pcre_exec(const pcre *external_re, const pcre_extra *external_extra, const char *subject, int length, int start_offset, int options, int *offsets, int offsetcount) { @@ -4944,7 +4944,7 @@ if (re->top_backref > 0 && re->top_backref >= ocount/3) { ocount = re->top_backref * 3 + 3; - match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int)); + match_block.offset_vector = (int *)(ap_pcre_malloc)(ocount * sizeof(int)); if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY; using_temporary_offsets = TRUE; DPRINTF(("Got memory to hold back references\n")); @@ -5139,7 +5139,7 @@ match_block.offset_overflow = TRUE; DPRINTF(("Freeing temporary memory\n")); - (pcre_free)(match_block.offset_vector); + (ap_pcre_free)(match_block.offset_vector); } rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2; @@ -5163,7 +5163,7 @@ if (using_temporary_offsets) { DPRINTF(("Freeing temporary memory\n")); - (pcre_free)(match_block.offset_vector); + (ap_pcre_free)(match_block.offset_vector); } DPRINTF((">>>> returning %d\n", match_block.errorcode)); --- orig/apache2/srclib/pcre/pcre.def +++ mod/apache2/srclib/pcre/pcre.def @@ -1,19 +1,19 @@ EXPORTS -pcre_malloc DATA -pcre_free DATA +ap_pcre_malloc DATA +ap_pcre_free DATA -pcre_compile -pcre_copy_substring -pcre_exec -pcre_get_substring -pcre_get_substring_list -pcre_info -pcre_maketables -pcre_study -pcre_version +ap_pcre_compile +ap_pcre_copy_substring +ap_pcre_exec +ap_pcre_get_substring +ap_pcre_get_substring_list +ap_pcre_info +ap_pcre_maketables +ap_pcre_study +ap_pcre_version -regcomp -regexec -regerror -regfree +ap_pcreposix_regcomp +ap_pcreposix_regexec +ap_pcreposix_regerror +ap_pcreposix_regfree --- orig/apache2/srclib/pcre/pcre.hw +++ mod/apache2/srclib/pcre/pcre.hw @@ -62,7 +62,7 @@ #define PCRE_ERROR_NOMEMORY (-6) #define PCRE_ERROR_NOSUBSTRING (-7) -/* Request types for pcre_fullinfo() */ +/* Request types for ap_pcre_fullinfo() */ #define PCRE_INFO_OPTIONS 0 #define PCRE_INFO_SIZE 1 @@ -84,27 +84,27 @@ functions if required. Some magic is required for Win32 DLL; it is null on other OS. */ -PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t); -PCRE_DL_IMPORT extern void (*pcre_free)(void *); +PCRE_DL_IMPORT extern void *(*ap_pcre_malloc)(size_t); +PCRE_DL_IMPORT extern void (*ap_pcre_free)(void *); #undef PCRE_DL_IMPORT /* Functions */ -extern pcre *pcre_compile(const char *, int, const char **, int *, +extern pcre *ap_pcre_compile(const char *, int, const char **, int *, const unsigned char *); -extern int pcre_copy_substring(const char *, int *, int, int, char *, int); -extern int pcre_exec(const pcre *, const pcre_extra *, const char *, +extern int ap_pcre_copy_substring(const char *, int *, int, int, char *, int); +extern int ap_pcre_exec(const pcre *, const pcre_extra *, const char *, int, int, int, int *, int); -extern void pcre_free_substring(const char *); -extern void pcre_free_substring_list(const char **); -extern int pcre_get_substring(const char *, int *, int, int, const char **); -extern int pcre_get_substring_list(const char *, int *, int, const char ***); -extern int pcre_info(const pcre *, int *, int *); -extern int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); -extern const unsigned char *pcre_maketables(void); -extern pcre_extra *pcre_study(const pcre *, int, const char **); -extern const char *pcre_version(void); +extern void ap_pcre_free_substring(const char *); +extern void ap_pcre_free_substring_list(const char **); +extern int ap_pcre_get_substring(const char *, int *, int, int, const char **); +extern int ap_pcre_get_substring_list(const char *, int *, int, const char ***); +extern int ap_pcre_info(const pcre *, int *, int *); +extern int ap_pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); +extern const unsigned char *ap_pcre_maketables(void); +extern pcre_extra *ap_pcre_study(const pcre *, int, const char **); +extern const char *ap_pcre_version(void); #ifdef __cplusplus } /* extern "C" */ --- orig/apache2/srclib/pcre/pcre.in +++ mod/apache2/srclib/pcre/pcre.in @@ -62,7 +62,7 @@ #define PCRE_ERROR_NOMEMORY (-6) #define PCRE_ERROR_NOSUBSTRING (-7) -/* Request types for pcre_fullinfo() */ +/* Request types for ap_pcre_fullinfo() */ #define PCRE_INFO_OPTIONS 0 #define PCRE_INFO_SIZE 1 @@ -84,27 +84,27 @@ functions if required. Some magic is required for Win32 DLL; it is null on other OS. */ -PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t); -PCRE_DL_IMPORT extern void (*pcre_free)(void *); +PCRE_DL_IMPORT extern void *(*ap_pcre_malloc)(size_t); +PCRE_DL_IMPORT extern void (*ap_pcre_free)(void *); #undef PCRE_DL_IMPORT /* Functions */ -extern pcre *pcre_compile(const char *, int, const char **, int *, +extern pcre *ap_pcre_compile(const char *, int, const char **, int *, const unsigned char *); -extern int pcre_copy_substring(const char *, int *, int, int, char *, int); -extern int pcre_exec(const pcre *, const pcre_extra *, const char *, +extern int ap_pcre_copy_substring(const char *, int *, int, int, char *, int); +extern int ap_pcre_exec(const pcre *, const pcre_extra *, const char *, int, int, int, int *, int); -extern void pcre_free_substring(const char *); -extern void pcre_free_substring_list(const char **); -extern int pcre_get_substring(const char *, int *, int, int, const char **); -extern int pcre_get_substring_list(const char *, int *, int, const char ***); -extern int pcre_info(const pcre *, int *, int *); -extern int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); -extern const unsigned char *pcre_maketables(void); -extern pcre_extra *pcre_study(const pcre *, int, const char **); -extern const char *pcre_version(void); +extern void ap_pcre_free_substring(const char *); +extern void ap_pcre_free_substring_list(const char **); +extern int ap_pcre_get_substring(const char *, int *, int, int, const char **); +extern int ap_pcre_get_substring_list(const char *, int *, int, const char ***); +extern int ap_pcre_info(const pcre *, int *, int *); +extern int ap_pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); +extern const unsigned char *ap_pcre_maketables(void); +extern pcre_extra *ap_pcre_study(const pcre *, int, const char **); +extern const char *ap_pcre_version(void); #ifdef __cplusplus } /* extern "C" */ --- orig/apache2/srclib/pcre/pcredemo.c +++ mod/apache2/srclib/pcre/pcredemo.c @@ -25,7 +25,7 @@ /* Compile the regular expression in the first argument */ -re = pcre_compile( +re = ap_pcre_compile( argv[1], /* the pattern */ 0, /* default options */ &error, /* for error message */ @@ -42,7 +42,7 @@ /* Compilation succeeded: match the subject in the second argument */ -rc = pcre_exec( +rc = ap_pcre_exec( re, /* the compiled pattern */ NULL, /* no extra data - we didn't study the pattern */ argv[2], /* the subject string */ --- orig/apache2/srclib/pcre/pcregrep.c +++ mod/apache2/srclib/pcre/pcregrep.c @@ -181,7 +181,7 @@ for (i = 0; !match && i < pattern_count; i++) { - match = pcre_exec(pattern_list[i], hints_list[i], buffer, length, 0, 0, + match = ap_pcre_exec(pattern_list[i], hints_list[i], buffer, length, 0, 0, offsets, 99) >= 0; if (match && whole_lines && offsets[1] != length) match = FALSE; } @@ -355,7 +355,7 @@ case 'V': fprintf(stderr, "pcregrep version %s using ", VERSION); - fprintf(stderr, "PCRE version %s\n", pcre_version()); + fprintf(stderr, "PCRE version %s\n", ap_pcre_version()); exit(0); break; @@ -476,7 +476,7 @@ while (s > buffer && isspace((unsigned char)(s[-1]))) s--; if (s == buffer) continue; *s = 0; - pattern_list[pattern_count] = pcre_compile(buffer, options, &error, + pattern_list[pattern_count] = ap_pcre_compile(buffer, options, &error, &errptr, NULL); if (pattern_list[pattern_count++] == NULL) { @@ -493,7 +493,7 @@ else { if (i >= argc) return usage(0); - pattern_list[0] = pcre_compile(argv[i++], options, &error, &errptr, NULL); + pattern_list[0] = ap_pcre_compile(argv[i++], options, &error, &errptr, NULL); if (pattern_list[0] == NULL) { fprintf(stderr, "pcregrep: Error in regex at offset %d: %s\n", errptr, @@ -507,7 +507,7 @@ for (j = 0; j < pattern_count; j++) { - hints_list[j] = pcre_study(pattern_list[j], 0, &error); + hints_list[j] = ap_pcre_study(pattern_list[j], 0, &error); if (error != NULL) { char s[16]; --- orig/apache2/srclib/pcre/pcreposix.c +++ mod/apache2/srclib/pcre/pcreposix.c @@ -136,7 +136,7 @@ *************************************************/ size_t -regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) +ap_pcreposix_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { const char *message, *addmessage; size_t length, addlength; @@ -171,9 +171,9 @@ *************************************************/ void -regfree(regex_t *preg) +ap_pcreposix_regfree(regex_t *preg) { -(pcre_free)(preg->re_pcre); +(ap_pcre_free)(preg->re_pcre); } @@ -194,7 +194,7 @@ */ int -regcomp(regex_t *preg, const char *pattern, int cflags) +ap_pcreposix_regcomp(regex_t *preg, const char *pattern, int cflags) { const char *errorptr; int erroffset; @@ -203,12 +203,12 @@ if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS; if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE; -preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL); +preg->re_pcre = ap_pcre_compile(pattern, options, &errorptr, &erroffset, NULL); preg->re_erroffset = erroffset; if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr); -preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL); +preg->re_nsub = ap_pcre_info(preg->re_pcre, NULL, NULL); return 0; } @@ -226,7 +226,7 @@ #define SMALL_NMATCH 5 int -regexec(regex_t *preg, const char *string, size_t nmatch, +ap_pcreposix_regexec(regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { int rc; @@ -266,7 +266,7 @@ } } -rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options, +rc = ap_pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options, ovector, nmatch * 3); if (rc == 0) rc = nmatch; /* All captured slots were filled in */ --- orig/apache2/srclib/pcre/pcreposix.h +++ mod/apache2/srclib/pcre/pcreposix.h @@ -76,10 +76,10 @@ /* The functions */ -extern int regcomp(regex_t *, const char *, int); -extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int); -extern size_t regerror(int, const regex_t *, char *, size_t); -extern void regfree(regex_t *); +extern int ap_pcreposix_regcomp(regex_t *, const char *, int); +extern int ap_pcreposix_regexec(regex_t *, const char *, size_t, regmatch_t *, int); +extern size_t ap_pcreposix_regerror(int, const regex_t *, char *, size_t); +extern void ap_pcreposix_regfree(regex_t *); #ifdef __cplusplus } /* extern "C" */ --- orig/apache2/srclib/pcre/pcretest.c +++ mod/apache2/srclib/pcre/pcretest.c @@ -9,7 +9,7 @@ #include #include -/* Use the internal info for displaying the results of pcre_study(). */ +/* Use the internal info for displaying the results of ap_pcre_study(). */ #include "internal.h" @@ -409,13 +409,13 @@ -/* Get one piece of information from the pcre_fullinfo() function */ +/* Get one piece of information from the ap_pcre_fullinfo() function */ static void new_info(pcre *re, pcre_extra *study, int option, void *ptr) { int rc; -if ((rc = pcre_fullinfo(re, study, option, ptr)) < 0) - fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option); +if ((rc = ap_pcre_fullinfo(re, study, option, ptr)) < 0) + fprintf(outfile, "Error %d from ap_pcre_fullinfo(%d)\n", rc, option); } @@ -522,11 +522,11 @@ /* Set alternative malloc function */ -pcre_malloc = new_malloc; +ap_pcre_malloc = new_malloc; /* Heading line, then prompt for first regex if stdin */ -fprintf(outfile, "PCRE version %s\n\n", pcre_version()); +fprintf(outfile, "PCRE version %s\n\n", ap_pcre_version()); /* Main loop */ @@ -652,7 +652,7 @@ fprintf(outfile, "** Failed to set locale \"%s\"\n", pp); goto SKIP_DATA; } - tables = pcre_maketables(); + tables = ap_pcre_maketables(); pp = ppp; break; @@ -674,14 +674,14 @@ int cflags = 0; if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE; if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE; - rc = regcomp(&preg, (char *)p, cflags); + rc = ap_pcreposix_regcomp(&preg, (char *)p, cflags); /* Compilation failed; go back for another re, skipping to blank line if non-interactive. */ if (rc != 0) { - (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer)); + (void)ap_pcreposix_regerror(rc, &preg, (char *)buffer, sizeof(buffer)); fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer); goto SKIP_DATA; } @@ -700,7 +700,7 @@ clock_t start_time = clock(); for (i = 0; i < LOOPREPEAT; i++) { - re = pcre_compile((char *)p, options, &error, &erroroffset, tables); + re = ap_pcre_compile((char *)p, options, &error, &erroroffset, tables); if (re != NULL) free(re); } time_taken = clock() - start_time; @@ -709,7 +709,7 @@ ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC)); } - re = pcre_compile((char *)p, options, &error, &erroroffset, tables); + re = ap_pcre_compile((char *)p, options, &error, &erroroffset, tables); /* Compilation failed; go back for another re, skipping to blank line if non-interactive. */ @@ -756,26 +756,26 @@ new_info(re, NULL, PCRE_INFO_FIRSTCHAR, &first_char); new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char); - old_count = pcre_info(re, &old_options, &old_first_char); + old_count = ap_pcre_info(re, &old_options, &old_first_char); if (count < 0) fprintf(outfile, - "Error %d from pcre_info()\n", count); + "Error %d from ap_pcre_info()\n", count); else { if (old_count != count) fprintf(outfile, - "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count, + "Count disagreement: ap_pcre_fullinfo=%d ap_pcre_info=%d\n", count, old_count); if (old_first_char != first_char) fprintf(outfile, - "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n", + "First char disagreement: ap_pcre_fullinfo=%d ap_pcre_info=%d\n", first_char, old_first_char); if (old_options != (int)get_options) fprintf(outfile, - "Options disagreement: pcre_fullinfo=%ld pcre_info=%d\n", + "Options disagreement: ap_pcre_fullinfo=%ld ap_pcre_info=%d\n", get_options, old_options); } if (size != gotten_store) fprintf(outfile, - "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n", + "Size disagreement: ap_pcre_fullinfo=%d call to malloc for %d\n", size, gotten_store); fprintf(outfile, "Capturing subpattern count = %d\n", count); @@ -836,7 +836,7 @@ clock_t time_taken; clock_t start_time = clock(); for (i = 0; i < LOOPREPEAT; i++) - extra = pcre_study(re, study_options, &error); + extra = ap_pcre_study(re, study_options, &error); time_taken = clock() - start_time; if (extra != NULL) free(extra); fprintf(outfile, " Study time %.3f milliseconds\n", @@ -844,7 +844,7 @@ ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC)); } - extra = pcre_study(re, study_options, &error); + extra = ap_pcre_study(re, study_options, &error); if (error != NULL) fprintf(outfile, "Failed to study: %s\n", error); else if (extra == NULL) @@ -1047,11 +1047,11 @@ if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL; if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL; - rc = regexec(&preg, (const char *)bptr, use_size_offsets, pmatch, eflags); + rc = ap_pcreposix_regexec(&preg, (const char *)bptr, use_size_offsets, pmatch, eflags); if (rc != 0) { - (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer)); + (void)ap_pcreposix_regerror(rc, &preg, (char *)buffer, sizeof(buffer)); fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer); } else @@ -1090,7 +1090,7 @@ clock_t time_taken; clock_t start_time = clock(); for (i = 0; i < LOOPREPEAT; i++) - count = pcre_exec(re, extra, (char *)bptr, len, + count = ap_pcre_exec(re, extra, (char *)bptr, len, start_offset, options | g_notempty, use_offsets, use_size_offsets); time_taken = clock() - start_time; fprintf(outfile, "Execute time %.3f milliseconds\n", @@ -1098,7 +1098,7 @@ ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC)); } - count = pcre_exec(re, extra, (char *)bptr, len, + count = ap_pcre_exec(re, extra, (char *)bptr, len, start_offset, options | g_notempty, use_offsets, use_size_offsets); if (count == 0) @@ -1138,7 +1138,7 @@ if ((copystrings & (1 << i)) != 0) { char copybuffer[16]; - int rc = pcre_copy_substring((char *)bptr, use_offsets, count, + int rc = ap_pcre_copy_substring((char *)bptr, use_offsets, count, i, copybuffer, sizeof(copybuffer)); if (rc < 0) fprintf(outfile, "copy substring %d failed %d\n", i, rc); @@ -1152,7 +1152,7 @@ if ((getstrings & (1 << i)) != 0) { const char *substring; - int rc = pcre_get_substring((char *)bptr, use_offsets, count, + int rc = ap_pcre_get_substring((char *)bptr, use_offsets, count, i, &substring); if (rc < 0) fprintf(outfile, "get substring %d failed %d\n", i, rc); @@ -1160,7 +1160,7 @@ { fprintf(outfile, "%2dG %s (%d)\n", i, substring, rc); /* free((void *)substring); */ - pcre_free_substring(substring); + ap_pcre_free_substring(substring); } } } @@ -1168,7 +1168,7 @@ if (getlist) { const char **stringlist; - int rc = pcre_get_substring_list((char *)bptr, use_offsets, count, + int rc = ap_pcre_get_substring_list((char *)bptr, use_offsets, count, &stringlist); if (rc < 0) fprintf(outfile, "get substring list failed %d\n", rc); @@ -1179,7 +1179,7 @@ if (stringlist[i] != NULL) fprintf(outfile, "string list not terminated by NULL\n"); /* free((void *)stringlist); */ - pcre_free_substring_list(stringlist); + ap_pcre_free_substring_list(stringlist); } } } @@ -1243,7 +1243,7 @@ CONTINUE: #if !defined NOPOSIX - if (posix || do_posix) regfree(&preg); + if (posix || do_posix) ap_pcreposix_regfree(&preg); #endif if (re != NULL) free(re); --- orig/apache2/srclib/pcre/pgrep.c +++ mod/apache2/srclib/pcre/pgrep.c @@ -74,7 +74,7 @@ if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0; linenumber++; - match = pcre_exec(pattern, hints, buffer, length, 0, 0, offsets, 99) >= 0; + match = ap_pcre_exec(pattern, hints, buffer, length, 0, 0, offsets, 99) >= 0; if (match && whole_lines && offsets[1] != length) match = FALSE; if (match != invert) @@ -161,7 +161,7 @@ case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break; case 'V': - fprintf(stderr, "PCRE version %s\n", pcre_version()); + fprintf(stderr, "PCRE version %s\n", ap_pcre_version()); break; default: @@ -177,7 +177,7 @@ /* Compile the regular expression. */ -pattern = pcre_compile(argv[i++], options, &error, &errptr, NULL); +pattern = ap_pcre_compile(argv[i++], options, &error, &errptr, NULL); if (pattern == NULL) { fprintf(stderr, "pgrep: error in regex at offset %d: %s\n", errptr, error); @@ -186,7 +186,7 @@ /* Study the regular expression, as we will be running it may times */ -hints = pcre_study(pattern, 0, &error); +hints = ap_pcre_study(pattern, 0, &error); if (error != NULL) { fprintf(stderr, "pgrep: error while studing regex: %s\n", error); --- orig/apache2/srclib/pcre/study.c +++ mod/apache2/srclib/pcre/study.c @@ -328,7 +328,7 @@ /* This function is handed a compiled expression that it must study to produce information that will speed up the matching. It returns a pcre_extra block -which then gets handed back to pcre_exec(). +which then gets handed back to ap_pcre_exec(). Arguments: re points to the compiled expression @@ -341,7 +341,7 @@ */ pcre_extra * -pcre_study(const pcre *external_re, int options, const char **errorptr) +ap_pcre_study(const pcre *external_re, int options, const char **errorptr) { uschar start_bits[32]; real_pcre_extra *extra; @@ -384,7 +384,7 @@ /* Get an "extra" block and put the information therein. */ -extra = (real_pcre_extra *)(pcre_malloc)(sizeof(real_pcre_extra)); +extra = (real_pcre_extra *)(ap_pcre_malloc)(sizeof(real_pcre_extra)); if (extra == NULL) {