summaryrefslogtreecommitdiff
path: root/pcretest.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-08-28 12:28:15 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-08-28 12:28:15 +0000
commit3183625c723f61bb3dd8b30b0cedb37932d65b4f (patch)
tree69e8a53fe952dc051c0d6d364de90cbfb6c44270 /pcretest.c
parente916d5250f3714258812969b29af506e0e031d97 (diff)
downloadpcre-3183625c723f61bb3dd8b30b0cedb37932d65b4f.tar.gz
Add support for PCRE_STUDY_EXTRA_NEEDED.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1022 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcretest.c')
-rw-r--r--pcretest.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/pcretest.c b/pcretest.c
index f4bdef9..0073b93 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -704,6 +704,9 @@ static int jit_study_bits[] =
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
};
+#define PCRE_STUDY_ALLJIT (PCRE_STUDY_JIT_COMPILE | \
+ PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE | PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE)
+
/* Textual explanations for runtime error codes */
static const char *errtexts[] = {
@@ -2796,7 +2799,7 @@ while (!done)
/* Look for options after final delimiter */
options = 0;
- study_options = 0;
+ study_options = force_study_options;
log_store = showstore; /* default from command line */
while (*pp != 0)
@@ -2833,12 +2836,22 @@ while (!done)
#endif
case 'S':
- if (do_study == 0)
+ do_study = 1;
+ for (;;)
{
- do_study = 1;
- if (*pp == '+')
+ switch (*pp++)
{
- if (*(++pp) == '+')
+ case 'S':
+ do_study = 0;
+ no_force_study = 1;
+ break;
+
+ case '!':
+ study_options |= PCRE_STUDY_EXTRA_NEEDED;
+ break;
+
+ case '+':
+ if (*pp == '+')
{
verify_jit = TRUE;
pp++;
@@ -2847,13 +2860,18 @@ while (!done)
study_options |= jit_study_bits[*pp++ - '1'];
else
study_options |= jit_study_bits[6];
+ break;
+
+ case '-':
+ study_options &= ~PCRE_STUDY_ALLJIT;
+ break;
+
+ default:
+ pp--;
+ goto ENDLOOP;
}
}
- else
- {
- do_study = 0;
- no_force_study = 1;
- }
+ ENDLOOP:
break;
case 'U': options |= PCRE_UNGREEDY; break;
@@ -3083,7 +3101,7 @@ while (!done)
clock_t start_time = clock();
for (i = 0; i < timeit; i++)
{
- PCRE_STUDY(extra, re, study_options | force_study_options, &error);
+ PCRE_STUDY(extra, re, study_options, &error);
}
time_taken = clock() - start_time;
if (extra != NULL)
@@ -3094,7 +3112,7 @@ while (!done)
(((double)time_taken * 1000.0) / (double)timeit) /
(double)CLOCKS_PER_SEC);
}
- PCRE_STUDY(extra, re, study_options | force_study_options, &error);
+ PCRE_STUDY(extra, re, study_options, &error);
if (error != NULL)
fprintf(outfile, "Failed to study: %s\n", error);
else if (extra != NULL)
@@ -3354,7 +3372,8 @@ while (!done)
/* Show this only if the JIT was set by /S, not by -s. */
- if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0)
+ if ((study_options & PCRE_STUDY_ALLJIT) != 0 &&
+ (force_study_options & PCRE_STUDY_ALLJIT) == 0)
{
int jit;
if (new_info(re, extra, PCRE_INFO_JIT, &jit) == 0)