View | Details | Raw Unified | Return to bug 27550
Collapse All | Expand All

(-)file_not_specified_in_diff (-166 / +166 lines)
Line  Link Here
   srclib/pcre/dftables.c srclib/pcre/get.c
   srclib/pcre/dftables.c srclib/pcre/get.c
1
   srclib/pcre/internal.h srclib/pcre/maketables.c
1
   srclib/pcre/internal.h srclib/pcre/maketables.c
2
   srclib/pcre/pcre.c srclib/pcre/pcre.def
2
   srclib/pcre/pcre.c srclib/pcre/pcre.def
3
   srclib/pcre/pcre.hw srclib/pcre/pcre.in
3
   srclib/pcre/pcre.hw srclib/pcre/pcre.in
4
   srclib/pcre/pcredemo.c srclib/pcre/pcregrep.c
4
   srclib/pcre/pcredemo.c srclib/pcre/pcregrep.c
5
   srclib/pcre/pcreposix.c srclib/pcre/pcreposix.h
5
   srclib/pcre/pcreposix.c srclib/pcre/pcreposix.h
6
   srclib/pcre/pcretest.c srclib/pcre/pgrep.c
6
   srclib/pcre/pcretest.c srclib/pcre/pgrep.c
7
   srclib/pcre/study.c
7
   srclib/pcre/study.c
8
   {arch}/apache2/apache2--dilinger/apache2--dilinger--2.0/dilinger@voxel.net--2004/patch-log/patch-10
8
   {arch}/apache2/apache2--dilinger/apache2--dilinger--2.0/dilinger@voxel.net--2004/patch-log/patch-10
9
   ./srclib/pcre/RunTest.in
9
   ./srclib/pcre/RunTest.in
10
       --permissions 755
10
       --permissions 755
11
       => --permissions 644
11
       => --permissions 644
12
-- orig/apache2/server/util.c
12
++ mod/apache2/server/util.c
Lines 289-304 Link Here
289
}
289
}
290
290
291
/*
291
/*
292
 * Here's a pool-based interface to POSIX regex's regcomp().
292
 * Here's a pool-based interface to POSIX regex's ap_pcreposix_regcomp().
293
 * Note that we return regex_t instead of being passed one.
293
 * Note that we return regex_t instead of being passed one.
294
 * The reason is that if you use an already-used regex_t structure,
294
 * The reason is that if you use an already-used regex_t structure,
295
 * the memory that you've already allocated gets forgotten, and
295
 * the memory that you've already allocated gets forgotten, and
296
 * regfree() doesn't clear it. So we don't allow it.
296
 * ap_pcreposix_regfree() doesn't clear it. So we don't allow it.
297
 */
297
 */
298
298
299
static apr_status_t regex_cleanup(void *preg)
299
static apr_status_t regex_cleanup(void *preg)
300
{
300
{
301
    regfree((regex_t *) preg);
301
    ap_pcreposix_regfree((regex_t *) preg);
302
    return APR_SUCCESS;
302
    return APR_SUCCESS;
303
}
303
}
304
304
Lines 307-313 Link Here
307
{
307
{
308
    regex_t *preg = apr_palloc(p, sizeof(regex_t));
308
    regex_t *preg = apr_palloc(p, sizeof(regex_t));
309
309
310
    if (regcomp(preg, pattern, cflags)) {
310
    if (ap_pcreposix_regcomp(preg, pattern, cflags)) {
311
        return NULL;
311
        return NULL;
312
    }
312
    }
313
313
Lines 319-325 Link Here
319
319
320
AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg)
320
AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg)
321
{
321
{
322
    regfree(reg);
322
    ap_pcreposix_regfree(reg);
323
    apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup);
323
    apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup);
324
}
324
}
325
325
Lines 387-393 Link Here
387
}
387
}
388
388
389
/* 
389
/* 
390
 * Apache stub function for the regex libraries regexec() to make sure the
390
 * Apache stub function for the regex libraries ap_pcreposix_regexec() to make sure the
391
 * whole regex(3) API is available through the Apache (exported) namespace.
391
 * whole regex(3) API is available through the Apache (exported) namespace.
392
 * This is especially important for the DSO situations of modules.
392
 * This is especially important for the DSO situations of modules.
393
 * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
393
 * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
Lines 395-407 Link Here
395
AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string,
395
AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string,
396
                           size_t nmatch, regmatch_t pmatch[], int eflags)
396
                           size_t nmatch, regmatch_t pmatch[], int eflags)
397
{
397
{
398
    return regexec(preg, string, nmatch, pmatch, eflags);
398
    return ap_pcreposix_regexec(preg, string, nmatch, pmatch, eflags);
399
}
399
}
400
400
401
AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf,
401
AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf,
402
                               size_t errbuf_size)
402
                               size_t errbuf_size)
403
{
403
{
404
    return regerror(errcode, preg, errbuf, errbuf_size);
404
    return ap_pcreposix_regerror(errcode, preg, errbuf, errbuf_size);
405
}
405
}
406
406
407
407
408
-- orig/apache2/srclib/pcre/dftables.c
408
++ mod/apache2/srclib/pcre/dftables.c
Lines 36-42 Link Here
36
36
37
/* This is a support program to generate the file chartables.c, containing
37
/* This is a support program to generate the file chartables.c, containing
38
character tables of various kinds. They are built according to the default C
38
character tables of various kinds. They are built according to the default C
39
locale and used as the default tables by PCRE. Now that pcre_maketables is
39
locale and used as the default tables by PCRE. Now that ap_pcre_maketables is
40
a function visible to the outside world, we make use of its code from here in
40
a function visible to the outside world, we make use of its code from here in
41
order to be consistent. */
41
order to be consistent. */
42
42
Lines 53-59 Link Here
53
int main(void)
53
int main(void)
54
{
54
{
55
int i;
55
int i;
56
const unsigned char *tables = pcre_maketables();
56
const unsigned char *tables = ap_pcre_maketables();
57
57
58
printf(
58
printf(
59
  "/*************************************************\n"
59
  "/*************************************************\n"
60
-- orig/apache2/srclib/pcre/get.c
60
++ mod/apache2/srclib/pcre/get.c
Lines 56-62 Link Here
56
  subject        the subject string that was matched
56
  subject        the subject string that was matched
57
  ovector        pointer to the offsets table
57
  ovector        pointer to the offsets table
58
  stringcount    the number of substrings that were captured
58
  stringcount    the number of substrings that were captured
59
                   (i.e. the yield of the pcre_exec call, unless
59
                   (i.e. the yield of the ap_pcre_exec call, unless
60
                   that was zero, in which case it should be 1/3
60
                   that was zero, in which case it should be 1/3
61
                   of the offset table size)
61
                   of the offset table size)
62
  stringnumber   the number of the required substring
62
  stringnumber   the number of the required substring
Lines 72-78 Link Here
72
*/
72
*/
73
73
74
int
74
int
75
pcre_copy_substring(const char *subject, int *ovector, int stringcount,
75
ap_pcre_copy_substring(const char *subject, int *ovector, int stringcount,
76
  int stringnumber, char *buffer, int size)
76
  int stringnumber, char *buffer, int size)
77
{
77
{
78
int yield;
78
int yield;
Lines 99-105 Link Here
99
  subject        the subject string that was matched
99
  subject        the subject string that was matched
100
  ovector        pointer to the offsets table
100
  ovector        pointer to the offsets table
101
  stringcount    the number of substrings that were captured
101
  stringcount    the number of substrings that were captured
102
                   (i.e. the yield of the pcre_exec call, unless
102
                   (i.e. the yield of the ap_pcre_exec call, unless
103
                   that was zero, in which case it should be 1/3
103
                   that was zero, in which case it should be 1/3
104
                   of the offset table size)
104
                   of the offset table size)
105
  listptr        set to point to the list of pointers
105
  listptr        set to point to the list of pointers
Lines 110-116 Link Here
110
*/
110
*/
111
111
112
int
112
int
113
pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
113
ap_pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
114
  const char ***listptr)
114
  const char ***listptr)
115
{
115
{
116
int i;
116
int i;
Lines 122-128 Link Here
122
for (i = 0; i < double_count; i += 2)
122
for (i = 0; i < double_count; i += 2)
123
  size += sizeof(char *) + ovector[i+1] - ovector[i] + 1;
123
  size += sizeof(char *) + ovector[i+1] - ovector[i] + 1;
124
124
125
stringlist = (char **)(pcre_malloc)(size);
125
stringlist = (char **)(ap_pcre_malloc)(size);
126
if (stringlist == NULL) return PCRE_ERROR_NOMEMORY;
126
if (stringlist == NULL) return PCRE_ERROR_NOMEMORY;
127
127
128
*listptr = (const char **)stringlist;
128
*listptr = (const char **)stringlist;
Lines 144-163 Link Here
144
144
145
145
146
/*************************************************
146
/*************************************************
147
*   Free store obtained by get_substring_list    *
147
*   Free store obtained by ap_get_substring_list  *
148
*************************************************/
148
*************************************************/
149
149
150
/* This function exists for the benefit of people calling PCRE from non-C
150
/* This function exists for the benefit of people calling PCRE from non-C
151
programs that can call its functions, but not free() or (pcre_free)() directly.
151
programs that can call its functions, but not free() or (ap_pcre_free)() directly.
152
152
153
Argument:   the result of a previous pcre_get_substring_list()
153
Argument:   the result of a previous ap_pcre_get_substring_list()
154
Returns:    nothing
154
Returns:    nothing
155
*/
155
*/
156
156
157
void
157
void
158
pcre_free_substring_list(const char **pointer)
158
ap_pcre_free_substring_list(const char **pointer)
159
{
159
{
160
(pcre_free)((void *)pointer);
160
(ap_pcre_free)((void *)pointer);
161
}
161
}
162
162
163
163
Lines 173-179 Link Here
173
  subject        the subject string that was matched
173
  subject        the subject string that was matched
174
  ovector        pointer to the offsets table
174
  ovector        pointer to the offsets table
175
  stringcount    the number of substrings that were captured
175
  stringcount    the number of substrings that were captured
176
                   (i.e. the yield of the pcre_exec call, unless
176
                   (i.e. the yield of the ap_pcre_exec call, unless
177
                   that was zero, in which case it should be 1/3
177
                   that was zero, in which case it should be 1/3
178
                   of the offset table size)
178
                   of the offset table size)
179
  stringnumber   the number of the required substring
179
  stringnumber   the number of the required substring
Lines 188-194 Link Here
188
*/
188
*/
189
189
190
int
190
int
191
pcre_get_substring(const char *subject, int *ovector, int stringcount,
191
ap_pcre_get_substring(const char *subject, int *ovector, int stringcount,
192
  int stringnumber, const char **stringptr)
192
  int stringnumber, const char **stringptr)
193
{
193
{
194
int yield;
194
int yield;
Lines 197-203 Link Here
197
  return PCRE_ERROR_NOSUBSTRING;
197
  return PCRE_ERROR_NOSUBSTRING;
198
stringnumber *= 2;
198
stringnumber *= 2;
199
yield = ovector[stringnumber+1] - ovector[stringnumber];
199
yield = ovector[stringnumber+1] - ovector[stringnumber];
200
substring = (char *)(pcre_malloc)(yield + 1);
200
substring = (char *)(ap_pcre_malloc)(yield + 1);
201
if (substring == NULL) return PCRE_ERROR_NOMEMORY;
201
if (substring == NULL) return PCRE_ERROR_NOMEMORY;
202
memcpy(substring, subject + ovector[stringnumber], yield);
202
memcpy(substring, subject + ovector[stringnumber], yield);
203
substring[yield] = 0;
203
substring[yield] = 0;
Lines 208-227 Link Here
208
208
209
209
210
/*************************************************
210
/*************************************************
211
*       Free store obtained by get_substring     *
211
*       Free store obtained by ap_get_substring   *
212
*************************************************/
212
*************************************************/
213
213
214
/* This function exists for the benefit of people calling PCRE from non-C
214
/* This function exists for the benefit of people calling PCRE from non-C
215
programs that can call its functions, but not free() or (pcre_free)() directly.
215
programs that can call its functions, but not free() or (ap_pcre_free)() directly.
216
216
217
Argument:   the result of a previous pcre_get_substring()
217
Argument:   the result of a previous pcre_get_substring()
218
Returns:    nothing
218
Returns:    nothing
219
*/
219
*/
220
220
221
void
221
void
222
pcre_free_substring(const char *pointer)
222
ap_pcre_free_substring(const char *pointer)
223
{
223
{
224
(pcre_free)((void *)pointer);
224
(ap_pcre_free)((void *)pointer);
225
}
225
}
226
226
227
/* End of get.c */
227
/* End of get.c */
228
-- orig/apache2/srclib/pcre/internal.h
228
++ mod/apache2/srclib/pcre/internal.h
Lines 96-102 Link Here
96
#define PCRE_INGROUP       0x08000000  /* compiling inside a group */
96
#define PCRE_INGROUP       0x08000000  /* compiling inside a group */
97
#define PCRE_ICHANGED      0x04000000  /* i option changes within regex */
97
#define PCRE_ICHANGED      0x04000000  /* i option changes within regex */
98
98
99
/* Options for the "extra" block produced by pcre_study(). */
99
/* Options for the "extra" block produced by ap_pcre_study(). */
100
100
101
#define PCRE_STUDY_MAPPED   0x01     /* a map of starting chars exists */
101
#define PCRE_STUDY_MAPPED   0x01     /* a map of starting chars exists */
102
102
Lines 334-340 Link Here
334
  uschar code[1];
334
  uschar code[1];
335
} real_pcre;
335
} real_pcre;
336
336
337
/* The real format of the extra block returned by pcre_study(). */
337
/* The real format of the extra block returned by ap_pcre_study(). */
338
338
339
typedef struct real_pcre_extra {
339
typedef struct real_pcre_extra {
340
  uschar options;
340
  uschar options;
341
-- orig/apache2/srclib/pcre/maketables.c
341
++ mod/apache2/srclib/pcre/maketables.c
Lines 51-57 Link Here
51
/* This function builds a set of character tables for use by PCRE and returns
51
/* This function builds a set of character tables for use by PCRE and returns
52
a pointer to them. They are build using the ctype functions, and consequently
52
a pointer to them. They are build using the ctype functions, and consequently
53
their contents will depend upon the current locale setting. When compiled as
53
their contents will depend upon the current locale setting. When compiled as
54
part of the library, the store is obtained via pcre_malloc(), but when compiled
54
part of the library, the store is obtained via ap_pcre_malloc(), but when compiled
55
inside dftables, use malloc().
55
inside dftables, use malloc().
56
56
57
Arguments:   none
57
Arguments:   none
Lines 59-71 Link Here
59
*/
59
*/
60
60
61
const unsigned char *
61
const unsigned char *
62
pcre_maketables(void)
62
ap_pcre_maketables(void)
63
{
63
{
64
unsigned char *yield, *p;
64
unsigned char *yield, *p;
65
int i;
65
int i;
66
66
67
#ifndef DFTABLES
67
#ifndef DFTABLES
68
yield = (unsigned char*)(pcre_malloc)(tables_length);
68
yield = (unsigned char*)(ap_pcre_malloc)(tables_length);
69
#else
69
#else
70
yield = (unsigned char*)malloc(tables_length);
70
yield = (unsigned char*)malloc(tables_length);
71
#endif
71
#endif
72
-- orig/apache2/srclib/pcre/pcre.c
72
++ mod/apache2/srclib/pcre/pcre.c
Lines 184-191 Link Here
184
indirections below, which are can be changed by the caller, but are shared
184
indirections below, which are can be changed by the caller, but are shared
185
between all threads. */
185
between all threads. */
186
186
187
void *(*pcre_malloc)(size_t) = malloc;
187
void *(*ap_pcre_malloc)(size_t) = malloc;
188
void  (*pcre_free)(void *) = free;
188
void  (*ap_pcre_free)(void *) = free;
189
189
190
190
191
191
Lines 255-261 Link Here
255
/* A default set of character tables is included in the PCRE binary. Its source
255
/* A default set of character tables is included in the PCRE binary. Its source
256
is built by the maketables auxiliary program, which uses the default C ctypes
256
is built by the maketables auxiliary program, which uses the default C ctypes
257
functions, and put in the file chartables.c. These tables are used by PCRE
257
functions, and put in the file chartables.c. These tables are used by PCRE
258
whenever the caller of pcre_compile() does not provide an alternate set of
258
whenever the caller of ap_pcre_compile() does not provide an alternate set of
259
tables. */
259
tables. */
260
260
261
#include "chartables.c"
261
#include "chartables.c"
Lines 330-336 Link Here
330
#define XSTRING(s) STRING(s)
330
#define XSTRING(s) STRING(s)
331
331
332
const char *
332
const char *
333
pcre_version(void)
333
ap_pcre_version(void)
334
{
334
{
335
return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE);
335
return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE);
336
}
336
}
Lines 347-353 Link Here
347
backwards compatibility. The public options are passed back in an int - though
347
backwards compatibility. The public options are passed back in an int - though
348
the re->options field has been expanded to a long int, all the public options
348
the re->options field has been expanded to a long int, all the public options
349
at the low end of it, and so even on 16-bit systems this will still be OK.
349
at the low end of it, and so even on 16-bit systems this will still be OK.
350
Therefore, I haven't changed the API for pcre_info().
350
Therefore, I haven't changed the API for ap_pcre_info().
351
351
352
Arguments:
352
Arguments:
353
  external_re   points to compiled code
353
  external_re   points to compiled code
Lines 361-367 Link Here
361
*/
361
*/
362
362
363
int
363
int
364
pcre_info(const pcre *external_re, int *optptr, int *first_char)
364
ap_pcre_info(const pcre *external_re, int *optptr, int *first_char)
365
{
365
{
366
const real_pcre *re = (const real_pcre *)external_re;
366
const real_pcre *re = (const real_pcre *)external_re;
367
if (re == NULL) return PCRE_ERROR_NULL;
367
if (re == NULL) return PCRE_ERROR_NULL;
Lines 392-398 Link Here
392
*/
392
*/
393
393
394
int
394
int
395
pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what,
395
ap_pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what,
396
  void *where)
396
  void *where)
397
{
397
{
398
const real_pcre *re = (const real_pcre *)external_re;
398
const real_pcre *re = (const real_pcre *)external_re;
Lines 2475-2481 Link Here
2475
*/
2475
*/
2476
2476
2477
pcre *
2477
pcre *
2478
pcre_compile(const char *pattern, int options, const char **errorptr,
2478
ap_pcre_compile(const char *pattern, int options, const char **errorptr,
2479
  int *erroroffset, const unsigned char *tables)
2479
  int *erroroffset, const unsigned char *tables)
2480
{
2480
{
2481
real_pcre *re;
2481
real_pcre *re;
Lines 3052-3058 Link Here
3052
difference to the value of the offsetof(). */
3052
difference to the value of the offsetof(). */
3053
3053
3054
size = length + offsetof(real_pcre, code[0]);
3054
size = length + offsetof(real_pcre, code[0]);
3055
re = (real_pcre *)(pcre_malloc)(size);
3055
re = (real_pcre *)(ap_pcre_malloc)(size);
3056
3056
3057
if (re == NULL)
3057
if (re == NULL)
3058
  {
3058
  {
Lines 3102-3108 Link Here
3102
3102
3103
if (*errorptr != NULL)
3103
if (*errorptr != NULL)
3104
  {
3104
  {
3105
  (pcre_free)(re);
3105
  (ap_pcre_free)(re);
3106
  PCRE_ERROR_RETURN:
3106
  PCRE_ERROR_RETURN:
3107
  *erroroffset = ptr - (const uschar *)pattern;
3107
  *erroroffset = ptr - (const uschar *)pattern;
3108
  return NULL;
3108
  return NULL;
Lines 3373-3379 Link Here
3373
if (code - re->code > length)
3373
if (code - re->code > length)
3374
  {
3374
  {
3375
  *errorptr = ERR23;
3375
  *errorptr = ERR23;
3376
  (pcre_free)(re);
3376
  (ap_pcre_free)(re);
3377
  *erroroffset = ptr - (uschar *)pattern;
3377
  *erroroffset = ptr - (uschar *)pattern;
3378
  return NULL;
3378
  return NULL;
3379
  }
3379
  }
Lines 3715-3721 Link Here
3715
3715
3716
      if (c < 16) save = stacksave; else
3716
      if (c < 16) save = stacksave; else
3717
        {
3717
        {
3718
        save = (int *)(pcre_malloc)((c+1) * sizeof(int));
3718
        save = (int *)(ap_pcre_malloc)((c+1) * sizeof(int));
3719
        if (save == NULL)
3719
        if (save == NULL)
3720
          {
3720
          {
3721
          save = stacksave;
3721
          save = stacksave;
Lines 3729-3735 Link Here
3729
        match_isgroup);
3729
        match_isgroup);
3730
      for (i = 1; i <= c; i++)
3730
      for (i = 1; i <= c; i++)
3731
        md->offset_vector[md->offset_end - i] = save[i];
3731
        md->offset_vector[md->offset_end - i] = save[i];
3732
      if (save != stacksave) (pcre_free)(save);
3732
      if (save != stacksave) (ap_pcre_free)(save);
3733
      if (!rc) return FALSE;
3733
      if (!rc) return FALSE;
3734
3734
3735
      /* In case the recursion has set more capturing values, save the final
3735
      /* In case the recursion has set more capturing values, save the final
Lines 4867-4873 Link Here
4867
4867
4868
Arguments:
4868
Arguments:
4869
  external_re     points to the compiled expression
4869
  external_re     points to the compiled expression
4870
  external_extra  points to "hints" from pcre_study() or is NULL
4870
  external_extra  points to "hints" from ap_pcre_study() or is NULL
4871
  subject         points to the subject string
4871
  subject         points to the subject string
4872
  length          length of subject string (may contain binary zeros)
4872
  length          length of subject string (may contain binary zeros)
4873
  start_offset    where to start in the subject string
4873
  start_offset    where to start in the subject string
Lines 4882-4888 Link Here
4882
*/
4882
*/
4883
4883
4884
int
4884
int
4885
pcre_exec(const pcre *external_re, const pcre_extra *external_extra,
4885
ap_pcre_exec(const pcre *external_re, const pcre_extra *external_extra,
4886
  const char *subject, int length, int start_offset, int options, int *offsets,
4886
  const char *subject, int length, int start_offset, int options, int *offsets,
4887
  int offsetcount)
4887
  int offsetcount)
4888
{
4888
{
Lines 4944-4950 Link Here
4944
if (re->top_backref > 0 && re->top_backref >= ocount/3)
4944
if (re->top_backref > 0 && re->top_backref >= ocount/3)
4945
  {
4945
  {
4946
  ocount = re->top_backref * 3 + 3;
4946
  ocount = re->top_backref * 3 + 3;
4947
  match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int));
4947
  match_block.offset_vector = (int *)(ap_pcre_malloc)(ocount * sizeof(int));
4948
  if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY;
4948
  if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY;
4949
  using_temporary_offsets = TRUE;
4949
  using_temporary_offsets = TRUE;
4950
  DPRINTF(("Got memory to hold back references\n"));
4950
  DPRINTF(("Got memory to hold back references\n"));
Lines 5139-5145 Link Here
5139
      match_block.offset_overflow = TRUE;
5139
      match_block.offset_overflow = TRUE;
5140
5140
5141
    DPRINTF(("Freeing temporary memory\n"));
5141
    DPRINTF(("Freeing temporary memory\n"));
5142
    (pcre_free)(match_block.offset_vector);
5142
    (ap_pcre_free)(match_block.offset_vector);
5143
    }
5143
    }
5144
5144
5145
  rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2;
5145
  rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2;
Lines 5163-5169 Link Here
5163
if (using_temporary_offsets)
5163
if (using_temporary_offsets)
5164
  {
5164
  {
5165
  DPRINTF(("Freeing temporary memory\n"));
5165
  DPRINTF(("Freeing temporary memory\n"));
5166
  (pcre_free)(match_block.offset_vector);
5166
  (ap_pcre_free)(match_block.offset_vector);
5167
  }
5167
  }
5168
5168
5169
DPRINTF((">>>> returning %d\n", match_block.errorcode));
5169
DPRINTF((">>>> returning %d\n", match_block.errorcode));
5170
-- orig/apache2/srclib/pcre/pcre.def
5170
++ mod/apache2/srclib/pcre/pcre.def
Lines 1-19 Link Here
1
EXPORTS
1
EXPORTS
2
2
3
pcre_malloc DATA
3
ap_pcre_malloc DATA
4
pcre_free DATA
4
ap_pcre_free DATA
5
5
6
pcre_compile
6
ap_pcre_compile
7
pcre_copy_substring
7
ap_pcre_copy_substring
8
pcre_exec
8
ap_pcre_exec
9
pcre_get_substring
9
ap_pcre_get_substring
10
pcre_get_substring_list
10
ap_pcre_get_substring_list
11
pcre_info
11
ap_pcre_info
12
pcre_maketables
12
ap_pcre_maketables
13
pcre_study
13
ap_pcre_study
14
pcre_version
14
ap_pcre_version
15
15
16
regcomp
16
ap_pcreposix_regcomp
17
regexec
17
ap_pcreposix_regexec
18
regerror
18
ap_pcreposix_regerror
19
regfree
19
ap_pcreposix_regfree
20
-- orig/apache2/srclib/pcre/pcre.hw
20
++ mod/apache2/srclib/pcre/pcre.hw
Lines 62-68 Link Here
62
#define PCRE_ERROR_NOMEMORY       (-6)
62
#define PCRE_ERROR_NOMEMORY       (-6)
63
#define PCRE_ERROR_NOSUBSTRING    (-7)
63
#define PCRE_ERROR_NOSUBSTRING    (-7)
64
64
65
/* Request types for pcre_fullinfo() */
65
/* Request types for ap_pcre_fullinfo() */
66
66
67
#define PCRE_INFO_OPTIONS         0
67
#define PCRE_INFO_OPTIONS         0
68
#define PCRE_INFO_SIZE            1
68
#define PCRE_INFO_SIZE            1
Lines 84-110 Link Here
84
functions if required. Some magic is required for Win32 DLL; it is null on
84
functions if required. Some magic is required for Win32 DLL; it is null on
85
other OS. */
85
other OS. */
86
86
87
PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t);
87
PCRE_DL_IMPORT extern void *(*ap_pcre_malloc)(size_t);
88
PCRE_DL_IMPORT extern void  (*pcre_free)(void *);
88
PCRE_DL_IMPORT extern void  (*ap_pcre_free)(void *);
89
89
90
#undef PCRE_DL_IMPORT
90
#undef PCRE_DL_IMPORT
91
91
92
/* Functions */
92
/* Functions */
93
93
94
extern pcre *pcre_compile(const char *, int, const char **, int *,
94
extern pcre *ap_pcre_compile(const char *, int, const char **, int *,
95
  const unsigned char *);
95
  const unsigned char *);
96
extern int pcre_copy_substring(const char *, int *, int, int, char *, int);
96
extern int ap_pcre_copy_substring(const char *, int *, int, int, char *, int);
97
extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
97
extern int ap_pcre_exec(const pcre *, const pcre_extra *, const char *,
98
  int, int, int, int *, int);
98
  int, int, int, int *, int);
99
extern void pcre_free_substring(const char *);
99
extern void ap_pcre_free_substring(const char *);
100
extern void pcre_free_substring_list(const char **);
100
extern void ap_pcre_free_substring_list(const char **);
101
extern int pcre_get_substring(const char *, int *, int, int, const char **);
101
extern int ap_pcre_get_substring(const char *, int *, int, int, const char **);
102
extern int pcre_get_substring_list(const char *, int *, int, const char ***);
102
extern int ap_pcre_get_substring_list(const char *, int *, int, const char ***);
103
extern int pcre_info(const pcre *, int *, int *);
103
extern int ap_pcre_info(const pcre *, int *, int *);
104
extern int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *);
104
extern int ap_pcre_fullinfo(const pcre *, const pcre_extra *, int, void *);
105
extern const unsigned char *pcre_maketables(void);
105
extern const unsigned char *ap_pcre_maketables(void);
106
extern pcre_extra *pcre_study(const pcre *, int, const char **);
106
extern pcre_extra *ap_pcre_study(const pcre *, int, const char **);
107
extern const char *pcre_version(void);
107
extern const char *ap_pcre_version(void);
108
108
109
#ifdef __cplusplus
109
#ifdef __cplusplus
110
}  /* extern "C" */
110
}  /* extern "C" */
111
-- orig/apache2/srclib/pcre/pcre.in
111
++ mod/apache2/srclib/pcre/pcre.in
Lines 62-68 Link Here
62
#define PCRE_ERROR_NOMEMORY       (-6)
62
#define PCRE_ERROR_NOMEMORY       (-6)
63
#define PCRE_ERROR_NOSUBSTRING    (-7)
63
#define PCRE_ERROR_NOSUBSTRING    (-7)
64
64
65
/* Request types for pcre_fullinfo() */
65
/* Request types for ap_pcre_fullinfo() */
66
66
67
#define PCRE_INFO_OPTIONS         0
67
#define PCRE_INFO_OPTIONS         0
68
#define PCRE_INFO_SIZE            1
68
#define PCRE_INFO_SIZE            1
Lines 84-110 Link Here
84
functions if required. Some magic is required for Win32 DLL; it is null on
84
functions if required. Some magic is required for Win32 DLL; it is null on
85
other OS. */
85
other OS. */
86
86
87
PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t);
87
PCRE_DL_IMPORT extern void *(*ap_pcre_malloc)(size_t);
88
PCRE_DL_IMPORT extern void  (*pcre_free)(void *);
88
PCRE_DL_IMPORT extern void  (*ap_pcre_free)(void *);
89
89
90
#undef PCRE_DL_IMPORT
90
#undef PCRE_DL_IMPORT
91
91
92
/* Functions */
92
/* Functions */
93
93
94
extern pcre *pcre_compile(const char *, int, const char **, int *,
94
extern pcre *ap_pcre_compile(const char *, int, const char **, int *,
95
              const unsigned char *);
95
              const unsigned char *);
96
extern int  pcre_copy_substring(const char *, int *, int, int, char *, int);
96
extern int  ap_pcre_copy_substring(const char *, int *, int, int, char *, int);
97
extern int  pcre_exec(const pcre *, const pcre_extra *, const char *,
97
extern int  ap_pcre_exec(const pcre *, const pcre_extra *, const char *,
98
              int, int, int, int *, int);
98
              int, int, int, int *, int);
99
extern void pcre_free_substring(const char *);
99
extern void ap_pcre_free_substring(const char *);
100
extern void pcre_free_substring_list(const char **);
100
extern void ap_pcre_free_substring_list(const char **);
101
extern int  pcre_get_substring(const char *, int *, int, int, const char **);
101
extern int  ap_pcre_get_substring(const char *, int *, int, int, const char **);
102
extern int  pcre_get_substring_list(const char *, int *, int, const char ***);
102
extern int  ap_pcre_get_substring_list(const char *, int *, int, const char ***);
103
extern int  pcre_info(const pcre *, int *, int *);
103
extern int  ap_pcre_info(const pcre *, int *, int *);
104
extern int  pcre_fullinfo(const pcre *, const pcre_extra *, int, void *);
104
extern int  ap_pcre_fullinfo(const pcre *, const pcre_extra *, int, void *);
105
extern const unsigned char *pcre_maketables(void);
105
extern const unsigned char *ap_pcre_maketables(void);
106
extern pcre_extra *pcre_study(const pcre *, int, const char **);
106
extern pcre_extra *ap_pcre_study(const pcre *, int, const char **);
107
extern const char *pcre_version(void);
107
extern const char *ap_pcre_version(void);
108
108
109
#ifdef __cplusplus
109
#ifdef __cplusplus
110
}  /* extern "C" */
110
}  /* extern "C" */
111
-- orig/apache2/srclib/pcre/pcredemo.c
111
++ mod/apache2/srclib/pcre/pcredemo.c
Lines 25-31 Link Here
25
25
26
/* Compile the regular expression in the first argument */
26
/* Compile the regular expression in the first argument */
27
27
28
re = pcre_compile(
28
re = ap_pcre_compile(
29
  argv[1],              /* the pattern */
29
  argv[1],              /* the pattern */
30
  0,                    /* default options */
30
  0,                    /* default options */
31
  &error,               /* for error message */
31
  &error,               /* for error message */
Lines 42-48 Link Here
42
42
43
/* Compilation succeeded: match the subject in the second argument */
43
/* Compilation succeeded: match the subject in the second argument */
44
44
45
rc = pcre_exec(
45
rc = ap_pcre_exec(
46
  re,                   /* the compiled pattern */
46
  re,                   /* the compiled pattern */
47
  NULL,                 /* no extra data - we didn't study the pattern */
47
  NULL,                 /* no extra data - we didn't study the pattern */
48
  argv[2],              /* the subject string */
48
  argv[2],              /* the subject string */
49
-- orig/apache2/srclib/pcre/pcregrep.c
49
++ mod/apache2/srclib/pcre/pcregrep.c
Lines 181-187 Link Here
181
181
182
  for (i = 0; !match && i < pattern_count; i++)
182
  for (i = 0; !match && i < pattern_count; i++)
183
    {
183
    {
184
    match = pcre_exec(pattern_list[i], hints_list[i], buffer, length, 0, 0,
184
    match = ap_pcre_exec(pattern_list[i], hints_list[i], buffer, length, 0, 0,
185
      offsets, 99) >= 0;
185
      offsets, 99) >= 0;
186
    if (match && whole_lines && offsets[1] != length) match = FALSE;
186
    if (match && whole_lines && offsets[1] != length) match = FALSE;
187
    }
187
    }
Lines 355-361 Link Here
355
355
356
  case 'V':
356
  case 'V':
357
  fprintf(stderr, "pcregrep version %s using ", VERSION);
357
  fprintf(stderr, "pcregrep version %s using ", VERSION);
358
  fprintf(stderr, "PCRE version %s\n", pcre_version());
358
  fprintf(stderr, "PCRE version %s\n", ap_pcre_version());
359
  exit(0);
359
  exit(0);
360
  break;
360
  break;
361
361
Lines 476-482 Link Here
476
    while (s > buffer && isspace((unsigned char)(s[-1]))) s--;
476
    while (s > buffer && isspace((unsigned char)(s[-1]))) s--;
477
    if (s == buffer) continue;
477
    if (s == buffer) continue;
478
    *s = 0;
478
    *s = 0;
479
    pattern_list[pattern_count] = pcre_compile(buffer, options, &error,
479
    pattern_list[pattern_count] = ap_pcre_compile(buffer, options, &error,
480
      &errptr, NULL);
480
      &errptr, NULL);
481
    if (pattern_list[pattern_count++] == NULL)
481
    if (pattern_list[pattern_count++] == NULL)
482
      {
482
      {
Lines 493-499 Link Here
493
else
493
else
494
  {
494
  {
495
  if (i >= argc) return usage(0);
495
  if (i >= argc) return usage(0);
496
  pattern_list[0] = pcre_compile(argv[i++], options, &error, &errptr, NULL);
496
  pattern_list[0] = ap_pcre_compile(argv[i++], options, &error, &errptr, NULL);
497
  if (pattern_list[0] == NULL)
497
  if (pattern_list[0] == NULL)
498
    {
498
    {
499
    fprintf(stderr, "pcregrep: Error in regex at offset %d: %s\n", errptr,
499
    fprintf(stderr, "pcregrep: Error in regex at offset %d: %s\n", errptr,
Lines 507-513 Link Here
507
507
508
for (j = 0; j < pattern_count; j++)
508
for (j = 0; j < pattern_count; j++)
509
  {
509
  {
510
  hints_list[j] = pcre_study(pattern_list[j], 0, &error);
510
  hints_list[j] = ap_pcre_study(pattern_list[j], 0, &error);
511
  if (error != NULL)
511
  if (error != NULL)
512
    {
512
    {
513
    char s[16];
513
    char s[16];
514
-- orig/apache2/srclib/pcre/pcreposix.c
514
++ mod/apache2/srclib/pcre/pcreposix.c
Lines 136-142 Link Here
136
*************************************************/
136
*************************************************/
137
137
138
size_t
138
size_t
139
regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
139
ap_pcreposix_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
140
{
140
{
141
const char *message, *addmessage;
141
const char *message, *addmessage;
142
size_t length, addlength;
142
size_t length, addlength;
Lines 171-179 Link Here
171
*************************************************/
171
*************************************************/
172
172
173
void
173
void
174
regfree(regex_t *preg)
174
ap_pcreposix_regfree(regex_t *preg)
175
{
175
{
176
(pcre_free)(preg->re_pcre);
176
(ap_pcre_free)(preg->re_pcre);
177
}
177
}
178
178
179
179
Lines 194-200 Link Here
194
*/
194
*/
195
195
196
int
196
int
197
regcomp(regex_t *preg, const char *pattern, int cflags)
197
ap_pcreposix_regcomp(regex_t *preg, const char *pattern, int cflags)
198
{
198
{
199
const char *errorptr;
199
const char *errorptr;
200
int erroffset;
200
int erroffset;
Lines 203-214 Link Here
203
if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
203
if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
204
if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
204
if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
205
205
206
preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
206
preg->re_pcre = ap_pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
207
preg->re_erroffset = erroffset;
207
preg->re_erroffset = erroffset;
208
208
209
if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr);
209
if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr);
210
210
211
preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL);
211
preg->re_nsub = ap_pcre_info(preg->re_pcre, NULL, NULL);
212
return 0;
212
return 0;
213
}
213
}
214
214
Lines 226-232 Link Here
226
226
227
#define SMALL_NMATCH 5
227
#define SMALL_NMATCH 5
228
int
228
int
229
regexec(regex_t *preg, const char *string, size_t nmatch,
229
ap_pcreposix_regexec(regex_t *preg, const char *string, size_t nmatch,
230
  regmatch_t pmatch[], int eflags)
230
  regmatch_t pmatch[], int eflags)
231
{
231
{
232
int rc;
232
int rc;
Lines 266-272 Link Here
266
      }
266
      }
267
  }
267
  }
268
268
269
rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options,
269
rc = ap_pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options,
270
  ovector, nmatch * 3);
270
  ovector, nmatch * 3);
271
271
272
if (rc == 0) rc = nmatch;    /* All captured slots were filled in */
272
if (rc == 0) rc = nmatch;    /* All captured slots were filled in */
273
-- orig/apache2/srclib/pcre/pcreposix.h
273
++ mod/apache2/srclib/pcre/pcreposix.h
Lines 76-85 Link Here
76
76
77
/* The functions */
77
/* The functions */
78
78
79
extern int regcomp(regex_t *, const char *, int);
79
extern int ap_pcreposix_regcomp(regex_t *, const char *, int);
80
extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
80
extern int ap_pcreposix_regexec(regex_t *, const char *, size_t, regmatch_t *, int);
81
extern size_t regerror(int, const regex_t *, char *, size_t);
81
extern size_t ap_pcreposix_regerror(int, const regex_t *, char *, size_t);
82
extern void regfree(regex_t *);
82
extern void ap_pcreposix_regfree(regex_t *);
83
83
84
#ifdef __cplusplus
84
#ifdef __cplusplus
85
}   /* extern "C" */
85
}   /* extern "C" */
86
-- orig/apache2/srclib/pcre/pcretest.c
86
++ mod/apache2/srclib/pcre/pcretest.c
Lines 9-15 Link Here
9
#include <time.h>
9
#include <time.h>
10
#include <locale.h>
10
#include <locale.h>
11
11
12
/* Use the internal info for displaying the results of pcre_study(). */
12
/* Use the internal info for displaying the results of ap_pcre_study(). */
13
13
14
#include "internal.h"
14
#include "internal.h"
15
15
Lines 409-421 Link Here
409
409
410
410
411
411
412
/* Get one piece of information from the pcre_fullinfo() function */
412
/* Get one piece of information from the ap_pcre_fullinfo() function */
413
413
414
static void new_info(pcre *re, pcre_extra *study, int option, void *ptr)
414
static void new_info(pcre *re, pcre_extra *study, int option, void *ptr)
415
{
415
{
416
int rc;
416
int rc;
417
if ((rc = pcre_fullinfo(re, study, option, ptr)) < 0)
417
if ((rc = ap_pcre_fullinfo(re, study, option, ptr)) < 0)
418
  fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option);
418
  fprintf(outfile, "Error %d from ap_pcre_fullinfo(%d)\n", rc, option);
419
}
419
}
420
420
421
421
Lines 522-532 Link Here
522
522
523
/* Set alternative malloc function */
523
/* Set alternative malloc function */
524
524
525
pcre_malloc = new_malloc;
525
ap_pcre_malloc = new_malloc;
526
526
527
/* Heading line, then prompt for first regex if stdin */
527
/* Heading line, then prompt for first regex if stdin */
528
528
529
fprintf(outfile, "PCRE version %s\n\n", pcre_version());
529
fprintf(outfile, "PCRE version %s\n\n", ap_pcre_version());
530
530
531
/* Main loop */
531
/* Main loop */
532
532
Lines 652-658 Link Here
652
        fprintf(outfile, "** Failed to set locale \"%s\"\n", pp);
652
        fprintf(outfile, "** Failed to set locale \"%s\"\n", pp);
653
        goto SKIP_DATA;
653
        goto SKIP_DATA;
654
        }
654
        }
655
      tables = pcre_maketables();
655
      tables = ap_pcre_maketables();
656
      pp = ppp;
656
      pp = ppp;
657
      break;
657
      break;
658
658
Lines 674-687 Link Here
674
    int cflags = 0;
674
    int cflags = 0;
675
    if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE;
675
    if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE;
676
    if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE;
676
    if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE;
677
    rc = regcomp(&preg, (char *)p, cflags);
677
    rc = ap_pcreposix_regcomp(&preg, (char *)p, cflags);
678
678
679
    /* Compilation failed; go back for another re, skipping to blank line
679
    /* Compilation failed; go back for another re, skipping to blank line
680
    if non-interactive. */
680
    if non-interactive. */
681
681
682
    if (rc != 0)
682
    if (rc != 0)
683
      {
683
      {
684
      (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));
684
      (void)ap_pcreposix_regerror(rc, &preg, (char *)buffer, sizeof(buffer));
685
      fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer);
685
      fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer);
686
      goto SKIP_DATA;
686
      goto SKIP_DATA;
687
      }
687
      }
Lines 700-706 Link Here
700
      clock_t start_time = clock();
700
      clock_t start_time = clock();
701
      for (i = 0; i < LOOPREPEAT; i++)
701
      for (i = 0; i < LOOPREPEAT; i++)
702
        {
702
        {
703
        re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
703
        re = ap_pcre_compile((char *)p, options, &error, &erroroffset, tables);
704
        if (re != NULL) free(re);
704
        if (re != NULL) free(re);
705
        }
705
        }
706
      time_taken = clock() - start_time;
706
      time_taken = clock() - start_time;
Lines 709-715 Link Here
709
        ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
709
        ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
710
      }
710
      }
711
711
712
    re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
712
    re = ap_pcre_compile((char *)p, options, &error, &erroroffset, tables);
713
713
714
    /* Compilation failed; go back for another re, skipping to blank line
714
    /* Compilation failed; go back for another re, skipping to blank line
715
    if non-interactive. */
715
    if non-interactive. */
Lines 756-781 Link Here
756
      new_info(re, NULL, PCRE_INFO_FIRSTCHAR, &first_char);
756
      new_info(re, NULL, PCRE_INFO_FIRSTCHAR, &first_char);
757
      new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char);
757
      new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char);
758
758
759
      old_count = pcre_info(re, &old_options, &old_first_char);
759
      old_count = ap_pcre_info(re, &old_options, &old_first_char);
760
      if (count < 0) fprintf(outfile,
760
      if (count < 0) fprintf(outfile,
761
        "Error %d from pcre_info()\n", count);
761
        "Error %d from ap_pcre_info()\n", count);
762
      else
762
      else
763
        {
763
        {
764
        if (old_count != count) fprintf(outfile,
764
        if (old_count != count) fprintf(outfile,
765
          "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count,
765
          "Count disagreement: ap_pcre_fullinfo=%d ap_pcre_info=%d\n", count,
766
            old_count);
766
            old_count);
767
767
768
        if (old_first_char != first_char) fprintf(outfile,
768
        if (old_first_char != first_char) fprintf(outfile,
769
          "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n",
769
          "First char disagreement: ap_pcre_fullinfo=%d ap_pcre_info=%d\n",
770
            first_char, old_first_char);
770
            first_char, old_first_char);
771
771
772
        if (old_options != (int)get_options) fprintf(outfile,
772
        if (old_options != (int)get_options) fprintf(outfile,
773
          "Options disagreement: pcre_fullinfo=%ld pcre_info=%d\n",
773
          "Options disagreement: ap_pcre_fullinfo=%ld ap_pcre_info=%d\n",
774
            get_options, old_options);
774
            get_options, old_options);
775
        }
775
        }
776
776
777
      if (size != gotten_store) fprintf(outfile,
777
      if (size != gotten_store) fprintf(outfile,
778
        "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n",
778
        "Size disagreement: ap_pcre_fullinfo=%d call to malloc for %d\n",
779
        size, gotten_store);
779
        size, gotten_store);
780
780
781
      fprintf(outfile, "Capturing subpattern count = %d\n", count);
781
      fprintf(outfile, "Capturing subpattern count = %d\n", count);
Lines 836-842 Link Here
836
        clock_t time_taken;
836
        clock_t time_taken;
837
        clock_t start_time = clock();
837
        clock_t start_time = clock();
838
        for (i = 0; i < LOOPREPEAT; i++)
838
        for (i = 0; i < LOOPREPEAT; i++)
839
          extra = pcre_study(re, study_options, &error);
839
          extra = ap_pcre_study(re, study_options, &error);
840
        time_taken = clock() - start_time;
840
        time_taken = clock() - start_time;
841
        if (extra != NULL) free(extra);
841
        if (extra != NULL) free(extra);
842
        fprintf(outfile, "  Study time %.3f milliseconds\n",
842
        fprintf(outfile, "  Study time %.3f milliseconds\n",
Lines 844-850 Link Here
844
          ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
844
          ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
845
        }
845
        }
846
846
847
      extra = pcre_study(re, study_options, &error);
847
      extra = ap_pcre_study(re, study_options, &error);
848
      if (error != NULL)
848
      if (error != NULL)
849
        fprintf(outfile, "Failed to study: %s\n", error);
849
        fprintf(outfile, "Failed to study: %s\n", error);
850
      else if (extra == NULL)
850
      else if (extra == NULL)
Lines 1047-1057 Link Here
1047
      if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL;
1047
      if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL;
1048
      if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL;
1048
      if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL;
1049
1049
1050
      rc = regexec(&preg, (const char *)bptr, use_size_offsets, pmatch, eflags);
1050
      rc = ap_pcreposix_regexec(&preg, (const char *)bptr, use_size_offsets, pmatch, eflags);
1051
1051
1052
      if (rc != 0)
1052
      if (rc != 0)
1053
        {
1053
        {
1054
        (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));
1054
        (void)ap_pcreposix_regerror(rc, &preg, (char *)buffer, sizeof(buffer));
1055
        fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer);
1055
        fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer);
1056
        }
1056
        }
1057
      else
1057
      else
Lines 1090-1096 Link Here
1090
        clock_t time_taken;
1090
        clock_t time_taken;
1091
        clock_t start_time = clock();
1091
        clock_t start_time = clock();
1092
        for (i = 0; i < LOOPREPEAT; i++)
1092
        for (i = 0; i < LOOPREPEAT; i++)
1093
          count = pcre_exec(re, extra, (char *)bptr, len,
1093
          count = ap_pcre_exec(re, extra, (char *)bptr, len,
1094
            start_offset, options | g_notempty, use_offsets, use_size_offsets);
1094
            start_offset, options | g_notempty, use_offsets, use_size_offsets);
1095
        time_taken = clock() - start_time;
1095
        time_taken = clock() - start_time;
1096
        fprintf(outfile, "Execute time %.3f milliseconds\n",
1096
        fprintf(outfile, "Execute time %.3f milliseconds\n",
Lines 1098-1104 Link Here
1098
          ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
1098
          ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
1099
        }
1099
        }
1100
1100
1101
      count = pcre_exec(re, extra, (char *)bptr, len,
1101
      count = ap_pcre_exec(re, extra, (char *)bptr, len,
1102
        start_offset, options | g_notempty, use_offsets, use_size_offsets);
1102
        start_offset, options | g_notempty, use_offsets, use_size_offsets);
1103
1103
1104
      if (count == 0)
1104
      if (count == 0)
Lines 1138-1144 Link Here
1138
          if ((copystrings & (1 << i)) != 0)
1138
          if ((copystrings & (1 << i)) != 0)
1139
            {
1139
            {
1140
            char copybuffer[16];
1140
            char copybuffer[16];
1141
            int rc = pcre_copy_substring((char *)bptr, use_offsets, count,
1141
            int rc = ap_pcre_copy_substring((char *)bptr, use_offsets, count,
1142
              i, copybuffer, sizeof(copybuffer));
1142
              i, copybuffer, sizeof(copybuffer));
1143
            if (rc < 0)
1143
            if (rc < 0)
1144
              fprintf(outfile, "copy substring %d failed %d\n", i, rc);
1144
              fprintf(outfile, "copy substring %d failed %d\n", i, rc);
Lines 1152-1158 Link Here
1152
          if ((getstrings & (1 << i)) != 0)
1152
          if ((getstrings & (1 << i)) != 0)
1153
            {
1153
            {
1154
            const char *substring;
1154
            const char *substring;
1155
            int rc = pcre_get_substring((char *)bptr, use_offsets, count,
1155
            int rc = ap_pcre_get_substring((char *)bptr, use_offsets, count,
1156
              i, &substring);
1156
              i, &substring);
1157
            if (rc < 0)
1157
            if (rc < 0)
1158
              fprintf(outfile, "get substring %d failed %d\n", i, rc);
1158
              fprintf(outfile, "get substring %d failed %d\n", i, rc);
Lines 1160-1166 Link Here
1160
              {
1160
              {
1161
              fprintf(outfile, "%2dG %s (%d)\n", i, substring, rc);
1161
              fprintf(outfile, "%2dG %s (%d)\n", i, substring, rc);
1162
              /* free((void *)substring); */
1162
              /* free((void *)substring); */
1163
              pcre_free_substring(substring);
1163
              ap_pcre_free_substring(substring);
1164
              }
1164
              }
1165
            }
1165
            }
1166
          }
1166
          }
Lines 1168-1174 Link Here
1168
        if (getlist)
1168
        if (getlist)
1169
          {
1169
          {
1170
          const char **stringlist;
1170
          const char **stringlist;
1171
          int rc = pcre_get_substring_list((char *)bptr, use_offsets, count,
1171
          int rc = ap_pcre_get_substring_list((char *)bptr, use_offsets, count,
1172
            &stringlist);
1172
            &stringlist);
1173
          if (rc < 0)
1173
          if (rc < 0)
1174
            fprintf(outfile, "get substring list failed %d\n", rc);
1174
            fprintf(outfile, "get substring list failed %d\n", rc);
Lines 1179-1185 Link Here
1179
            if (stringlist[i] != NULL)
1179
            if (stringlist[i] != NULL)
1180
              fprintf(outfile, "string list not terminated by NULL\n");
1180
              fprintf(outfile, "string list not terminated by NULL\n");
1181
            /* free((void *)stringlist); */
1181
            /* free((void *)stringlist); */
1182
            pcre_free_substring_list(stringlist);
1182
            ap_pcre_free_substring_list(stringlist);
1183
            }
1183
            }
1184
          }
1184
          }
1185
        }
1185
        }
Lines 1243-1249 Link Here
1243
  CONTINUE:
1243
  CONTINUE:
1244
1244
1245
#if !defined NOPOSIX
1245
#if !defined NOPOSIX
1246
  if (posix || do_posix) regfree(&preg);
1246
  if (posix || do_posix) ap_pcreposix_regfree(&preg);
1247
#endif
1247
#endif
1248
1248
1249
  if (re != NULL) free(re);
1249
  if (re != NULL) free(re);
1250
-- orig/apache2/srclib/pcre/pgrep.c
1250
++ mod/apache2/srclib/pcre/pgrep.c
Lines 74-80 Link Here
74
  if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0;
74
  if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0;
75
  linenumber++;
75
  linenumber++;
76
76
77
  match = pcre_exec(pattern, hints, buffer, length, 0, 0, offsets, 99) >= 0;
77
  match = ap_pcre_exec(pattern, hints, buffer, length, 0, 0, offsets, 99) >= 0;
78
  if (match && whole_lines && offsets[1] != length) match = FALSE;
78
  if (match && whole_lines && offsets[1] != length) match = FALSE;
79
79
80
  if (match != invert)
80
  if (match != invert)
Lines 161-167 Link Here
161
      case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break;
161
      case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break;
162
162
163
      case 'V':
163
      case 'V':
164
      fprintf(stderr, "PCRE version %s\n", pcre_version());
164
      fprintf(stderr, "PCRE version %s\n", ap_pcre_version());
165
      break;
165
      break;
166
166
167
      default:
167
      default:
Lines 177-183 Link Here
177
177
178
/* Compile the regular expression. */
178
/* Compile the regular expression. */
179
179
180
pattern = pcre_compile(argv[i++], options, &error, &errptr, NULL);
180
pattern = ap_pcre_compile(argv[i++], options, &error, &errptr, NULL);
181
if (pattern == NULL)
181
if (pattern == NULL)
182
  {
182
  {
183
  fprintf(stderr, "pgrep: error in regex at offset %d: %s\n", errptr, error);
183
  fprintf(stderr, "pgrep: error in regex at offset %d: %s\n", errptr, error);
Lines 186-192 Link Here
186
186
187
/* Study the regular expression, as we will be running it may times */
187
/* Study the regular expression, as we will be running it may times */
188
188
189
hints = pcre_study(pattern, 0, &error);
189
hints = ap_pcre_study(pattern, 0, &error);
190
if (error != NULL)
190
if (error != NULL)
191
  {
191
  {
192
  fprintf(stderr, "pgrep: error while studing regex: %s\n", error);
192
  fprintf(stderr, "pgrep: error while studing regex: %s\n", error);
193
-- orig/apache2/srclib/pcre/study.c
193
++ mod/apache2/srclib/pcre/study.c
Lines 328-334 Link Here
328
328
329
/* This function is handed a compiled expression that it must study to produce
329
/* This function is handed a compiled expression that it must study to produce
330
information that will speed up the matching. It returns a pcre_extra block
330
information that will speed up the matching. It returns a pcre_extra block
331
which then gets handed back to pcre_exec().
331
which then gets handed back to ap_pcre_exec().
332
332
333
Arguments:
333
Arguments:
334
  re        points to the compiled expression
334
  re        points to the compiled expression
Lines 341-347 Link Here
341
*/
341
*/
342
342
343
pcre_extra *
343
pcre_extra *
344
pcre_study(const pcre *external_re, int options, const char **errorptr)
344
ap_pcre_study(const pcre *external_re, int options, const char **errorptr)
345
{
345
{
346
uschar start_bits[32];
346
uschar start_bits[32];
347
real_pcre_extra *extra;
347
real_pcre_extra *extra;
Lines 384-390 Link Here
384
384
385
/* Get an "extra" block and put the information therein. */
385
/* Get an "extra" block and put the information therein. */
386
386
387
extra = (real_pcre_extra *)(pcre_malloc)(sizeof(real_pcre_extra));
387
extra = (real_pcre_extra *)(ap_pcre_malloc)(sizeof(real_pcre_extra));
388
388
389
if (extra == NULL)
389
if (extra == NULL)
390
  {
390
  {

Return to bug 27550