| 191 |
static int show_malloc; |
static int show_malloc; |
| 192 |
static int use_utf8; |
static int use_utf8; |
| 193 |
static size_t gotten_store; |
static size_t gotten_store; |
| 194 |
|
static size_t first_gotten_store = 0; |
| 195 |
static const unsigned char *last_callout_mark = NULL; |
static const unsigned char *last_callout_mark = NULL; |
| 196 |
|
|
| 197 |
/* The buffers grow automatically if very long input lines are encountered. */ |
/* The buffers grow automatically if very long input lines are encountered. */ |
| 1000 |
*************************************************/ |
*************************************************/ |
| 1001 |
|
|
| 1002 |
/* Alternative malloc function, to test functionality and save the size of a |
/* Alternative malloc function, to test functionality and save the size of a |
| 1003 |
compiled re. The show_malloc variable is set only during matching. */ |
compiled re, which is the first store request that pcre_compile() makes. The |
| 1004 |
|
show_malloc variable is set only during matching. */ |
| 1005 |
|
|
| 1006 |
static void *new_malloc(size_t size) |
static void *new_malloc(size_t size) |
| 1007 |
{ |
{ |
| 1008 |
void *block = malloc(size); |
void *block = malloc(size); |
| 1009 |
gotten_store = size; |
gotten_store = size; |
| 1010 |
|
if (first_gotten_store == 0) first_gotten_store = size; |
| 1011 |
if (show_malloc) |
if (show_malloc) |
| 1012 |
fprintf(outfile, "malloc %3d %p\n", (int)size, block); |
fprintf(outfile, "malloc %3d %p\n", (int)size, block); |
| 1013 |
return block; |
return block; |
| 1523 |
(sbuf[4] << 24) | (sbuf[5] << 16) | (sbuf[6] << 8) | sbuf[7]; |
(sbuf[4] << 24) | (sbuf[5] << 16) | (sbuf[6] << 8) | sbuf[7]; |
| 1524 |
|
|
| 1525 |
re = (real_pcre *)new_malloc(true_size); |
re = (real_pcre *)new_malloc(true_size); |
| 1526 |
regex_gotten_store = gotten_store; |
regex_gotten_store = first_gotten_store; |
| 1527 |
|
|
| 1528 |
if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ; |
if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ; |
| 1529 |
|
|
| 1780 |
if ((options & PCRE_UCP) != 0) cflags |= REG_UCP; |
if ((options & PCRE_UCP) != 0) cflags |= REG_UCP; |
| 1781 |
if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY; |
if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY; |
| 1782 |
|
|
| 1783 |
|
first_gotten_store = 0; |
| 1784 |
rc = regcomp(&preg, (char *)p, cflags); |
rc = regcomp(&preg, (char *)p, cflags); |
| 1785 |
|
|
| 1786 |
/* Compilation failed; go back for another re, skipping to blank line |
/* Compilation failed; go back for another re, skipping to blank line |
| 1818 |
(double)CLOCKS_PER_SEC); |
(double)CLOCKS_PER_SEC); |
| 1819 |
} |
} |
| 1820 |
|
|
| 1821 |
|
first_gotten_store = 0; |
| 1822 |
re = pcre_compile((char *)p, options, &error, &erroroffset, tables); |
re = pcre_compile((char *)p, options, &error, &erroroffset, tables); |
| 1823 |
|
|
| 1824 |
/* Compilation failed; go back for another re, skipping to blank line |
/* Compilation failed; go back for another re, skipping to blank line |
| 1859 |
|
|
| 1860 |
if (log_store) |
if (log_store) |
| 1861 |
fprintf(outfile, "Memory allocation (code space): %d\n", |
fprintf(outfile, "Memory allocation (code space): %d\n", |
| 1862 |
(int)(gotten_store - |
(int)(first_gotten_store - |
| 1863 |
sizeof(real_pcre) - |
sizeof(real_pcre) - |
| 1864 |
((real_pcre *)re)->name_count * ((real_pcre *)re)->name_entry_size)); |
((real_pcre *)re)->name_count * ((real_pcre *)re)->name_entry_size)); |
| 1865 |
|
|
| 1867 |
and remember the store that was got. */ |
and remember the store that was got. */ |
| 1868 |
|
|
| 1869 |
true_size = ((real_pcre *)re)->size; |
true_size = ((real_pcre *)re)->size; |
| 1870 |
regex_gotten_store = gotten_store; |
regex_gotten_store = first_gotten_store; |
| 1871 |
|
|
| 1872 |
/* If -s or /S was present, study the regex to generate additional info to |
/* If -s or /S was present, study the regex to generate additional info to |
| 1873 |
help with the matching, unless the pattern has the SS option, which |
help with the matching, unless the pattern has the SS option, which |