52 |
static size_t gotten_store; |
static size_t gotten_store; |
53 |
|
|
54 |
|
|
|
|
|
55 |
static const int utf8_table1[] = { |
static const int utf8_table1[] = { |
56 |
0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff}; |
0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff}; |
57 |
|
|
320 |
} |
} |
321 |
|
|
322 |
fprintf(outfile, "\n"); |
fprintf(outfile, "\n"); |
|
|
|
323 |
first_callout = 0; |
first_callout = 0; |
324 |
|
|
325 |
if ((int)(cb->callout_data) != 0) |
if (cb->callout_data != NULL) |
326 |
{ |
{ |
327 |
fprintf(outfile, "Callout data = %d\n", (int)(cb->callout_data)); |
int callout_data = *((int *)(cb->callout_data)); |
328 |
return (int)(cb->callout_data); |
if (callout_data != 0) |
329 |
|
{ |
330 |
|
fprintf(outfile, "Callout data = %d\n", callout_data); |
331 |
|
return callout_data; |
332 |
|
} |
333 |
} |
} |
334 |
|
|
335 |
return (cb->callout_number != callout_fail_id)? 0 : |
return (cb->callout_number != callout_fail_id)? 0 : |
399 |
/* Get buffers from malloc() so that Electric Fence will check their misuse |
/* Get buffers from malloc() so that Electric Fence will check their misuse |
400 |
when I am debugging. */ |
when I am debugging. */ |
401 |
|
|
402 |
buffer = malloc(BUFFER_SIZE); |
buffer = (unsigned char *)malloc(BUFFER_SIZE); |
403 |
dbuffer = malloc(DBUFFER_SIZE); |
dbuffer = (unsigned char *)malloc(DBUFFER_SIZE); |
404 |
|
|
405 |
/* Static so that new_malloc can use it. */ |
/* Static so that new_malloc can use it. */ |
406 |
|
|
466 |
/* Get the store for the offsets vector, and remember what it was */ |
/* Get the store for the offsets vector, and remember what it was */ |
467 |
|
|
468 |
size_offsets_max = size_offsets; |
size_offsets_max = size_offsets; |
469 |
offsets = malloc(size_offsets_max * sizeof(int)); |
offsets = (int *)malloc(size_offsets_max * sizeof(int)); |
470 |
if (offsets == NULL) |
if (offsets == NULL) |
471 |
{ |
{ |
472 |
printf("** Failed to get %d bytes of memory for offsets vector\n", |
printf("** Failed to get %d bytes of memory for offsets vector\n", |
621 |
case 'U': options |= PCRE_UNGREEDY; break; |
case 'U': options |= PCRE_UNGREEDY; break; |
622 |
case 'X': options |= PCRE_EXTRA; break; |
case 'X': options |= PCRE_EXTRA; break; |
623 |
case '8': options |= PCRE_UTF8; use_utf8 = 1; break; |
case '8': options |= PCRE_UTF8; use_utf8 = 1; break; |
624 |
|
case '?': options |= PCRE_NO_UTF8_CHECK; break; |
625 |
|
|
626 |
case 'L': |
case 'L': |
627 |
ppp = pp; |
ppp = pp; |
790 |
} |
} |
791 |
|
|
792 |
if (get_options == 0) fprintf(outfile, "No options\n"); |
if (get_options == 0) fprintf(outfile, "No options\n"); |
793 |
else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s\n", |
else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s\n", |
794 |
((get_options & PCRE_ANCHORED) != 0)? " anchored" : "", |
((get_options & PCRE_ANCHORED) != 0)? " anchored" : "", |
795 |
((get_options & PCRE_CASELESS) != 0)? " caseless" : "", |
((get_options & PCRE_CASELESS) != 0)? " caseless" : "", |
796 |
((get_options & PCRE_EXTENDED) != 0)? " extended" : "", |
((get_options & PCRE_EXTENDED) != 0)? " extended" : "", |
799 |
((get_options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "", |
((get_options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "", |
800 |
((get_options & PCRE_EXTRA) != 0)? " extra" : "", |
((get_options & PCRE_EXTRA) != 0)? " extra" : "", |
801 |
((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "", |
((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "", |
802 |
((get_options & PCRE_UTF8) != 0)? " utf8" : ""); |
((get_options & PCRE_UTF8) != 0)? " utf8" : "", |
803 |
|
((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf8_check" : ""); |
804 |
|
|
805 |
if (((((real_pcre *)re)->options) & PCRE_ICHANGED) != 0) |
if (((((real_pcre *)re)->options) & PCRE_ICHANGED) != 0) |
806 |
fprintf(outfile, "Case state changes\n"); |
fprintf(outfile, "Case state changes\n"); |
865 |
else if (extra == NULL) |
else if (extra == NULL) |
866 |
fprintf(outfile, "Study returned NULL\n"); |
fprintf(outfile, "Study returned NULL\n"); |
867 |
|
|
868 |
|
/* Don't output study size; at present it is in any case a fixed |
869 |
|
value, but it varies, depending on the computer architecture, and |
870 |
|
so messes up the test suite. */ |
871 |
|
|
872 |
else if (do_showinfo) |
else if (do_showinfo) |
873 |
{ |
{ |
874 |
size_t size; |
size_t size; |
875 |
uschar *start_bits = NULL; |
uschar *start_bits = NULL; |
876 |
new_info(re, extra, PCRE_INFO_STUDYSIZE, &size); |
new_info(re, extra, PCRE_INFO_STUDYSIZE, &size); |
877 |
new_info(re, extra, PCRE_INFO_FIRSTTABLE, &start_bits); |
new_info(re, extra, PCRE_INFO_FIRSTTABLE, &start_bits); |
878 |
fprintf(outfile, "Study size = %d\n", size); |
/* fprintf(outfile, "Study size = %d\n", size); */ |
879 |
if (start_bits == NULL) |
if (start_bits == NULL) |
880 |
fprintf(outfile, "No starting character set\n"); |
fprintf(outfile, "No starting character set\n"); |
881 |
else |
else |
1113 |
{ |
{ |
1114 |
size_offsets_max = n; |
size_offsets_max = n; |
1115 |
free(offsets); |
free(offsets); |
1116 |
use_offsets = offsets = malloc(size_offsets_max * sizeof(int)); |
use_offsets = offsets = (int *)malloc(size_offsets_max * sizeof(int)); |
1117 |
if (offsets == NULL) |
if (offsets == NULL) |
1118 |
{ |
{ |
1119 |
printf("** Failed to get %d bytes of memory for offsets vector\n", |
printf("** Failed to get %d bytes of memory for offsets vector\n", |
1128 |
case 'Z': |
case 'Z': |
1129 |
options |= PCRE_NOTEOL; |
options |= PCRE_NOTEOL; |
1130 |
continue; |
continue; |
1131 |
|
|
1132 |
|
case '?': |
1133 |
|
options |= PCRE_NO_UTF8_CHECK; |
1134 |
|
continue; |
1135 |
} |
} |
1136 |
*q++ = c; |
*q++ = c; |
1137 |
} |
} |
1148 |
int eflags = 0; |
int eflags = 0; |
1149 |
regmatch_t *pmatch = NULL; |
regmatch_t *pmatch = NULL; |
1150 |
if (use_size_offsets > 0) |
if (use_size_offsets > 0) |
1151 |
pmatch = malloc(sizeof(regmatch_t) * use_size_offsets); |
pmatch = (regmatch_t *)malloc(sizeof(regmatch_t) * use_size_offsets); |
1152 |
if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL; |
if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL; |
1153 |
if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL; |
if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL; |
1154 |
|
|
1215 |
|
|
1216 |
if (extra == NULL) |
if (extra == NULL) |
1217 |
{ |
{ |
1218 |
extra = malloc(sizeof(pcre_extra)); |
extra = (pcre_extra *)malloc(sizeof(pcre_extra)); |
1219 |
extra->flags = 0; |
extra->flags = 0; |
1220 |
} |
} |
1221 |
extra->flags |= PCRE_EXTRA_MATCH_LIMIT; |
extra->flags |= PCRE_EXTRA_MATCH_LIMIT; |
1254 |
{ |
{ |
1255 |
if (extra == NULL) |
if (extra == NULL) |
1256 |
{ |
{ |
1257 |
extra = malloc(sizeof(pcre_extra)); |
extra = (pcre_extra *)malloc(sizeof(pcre_extra)); |
1258 |
extra->flags = 0; |
extra->flags = 0; |
1259 |
} |
} |
1260 |
extra->flags |= PCRE_EXTRA_CALLOUT_DATA; |
extra->flags |= PCRE_EXTRA_CALLOUT_DATA; |
1261 |
extra->callout_data = (void *)callout_data; |
extra->callout_data = &callout_data; |
1262 |
count = pcre_exec(re, extra, (char *)bptr, len, start_offset, |
count = pcre_exec(re, extra, (char *)bptr, len, start_offset, |
1263 |
options | g_notempty, use_offsets, use_size_offsets); |
options | g_notempty, use_offsets, use_size_offsets); |
1264 |
extra->flags &= ~PCRE_EXTRA_CALLOUT_DATA; |
extra->flags &= ~PCRE_EXTRA_CALLOUT_DATA; |