-/* $Cambridge: exim/src/src/pcre/pcre_study.c,v 1.2 2005/08/08 10:22:14 ph10 Exp $ */
+/* $Cambridge: exim/src/src/pcre/pcre_study.c,v 1.3 2006/11/07 16:50:36 ph10 Exp $ */
/*************************************************
* Perl-Compatible Regular Expressions *
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2005 University of Cambridge
+ Copyright (c) 1997-2006 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
{
register int c;
+#if 0
+/* ========================================================================= */
+/* The following comment and code was inserted in January 1999. In May 2006,
+when it was observed to cause compiler warnings about unused values, I took it
+out again. If anybody is still using OS/2, they will have to put it back
+manually. */
+
/* This next statement and the later reference to dummy are here in order to
trick the optimizer of the IBM C compiler for OS/2 into generating correct
code. Apparently IBM isn't going to fix the problem, and we would rather not
the pcre module can use all the optimization it can get). */
volatile int dummy;
+/* ========================================================================= */
+#endif
do
{
case OP_BRAMINZERO:
if (!set_start_bits(++tcode, start_bits, caseless, utf8, cd))
return FALSE;
+/* =========================================================================
+ See the comment at the head of this function concerning the next line,
+ which was an old fudge for the benefit of OS/2.
dummy = 1;
+ ========================================================================= */
do tcode += GET(tcode,1); while (*tcode == OP_ALT);
tcode += 1+LINK_SIZE;
break;
try_next = FALSE;
break;
+ /* The cbit_space table has vertical tab as whitespace; we have to
+ discard it. */
+
case OP_NOT_WHITESPACE:
for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_space];
+ {
+ int d = cd->cbits[c+cbit_space];
+ if (c == 1) d &= ~0x08;
+ start_bits[c] |= ~d;
+ }
try_next = FALSE;
break;
+ /* The cbit_space table has vertical tab as whitespace; we have to
+ discard it. */
+
case OP_WHITESPACE:
for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_space];
+ {
+ int d = cd->cbits[c+cbit_space];
+ if (c == 1) d &= ~0x08;
+ start_bits[c] |= d;
+ }
try_next = FALSE;
break;
start_bits[c] |= cd->cbits[c+cbit_digit];
break;
+ /* The cbit_space table has vertical tab as whitespace; we have to
+ discard it. */
+
case OP_NOT_WHITESPACE:
for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_space];
+ {
+ int d = cd->cbits[c+cbit_space];
+ if (c == 1) d &= ~0x08;
+ start_bits[c] |= ~d;
+ }
break;
+ /* The cbit_space table has vertical tab as whitespace; we have to
+ discard it. */
+
case OP_WHITESPACE:
for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_space];
+ {
+ int d = cd->cbits[c+cbit_space];
+ if (c == 1) d &= ~0x08;
+ start_bits[c] |= d;
+ }
break;
case OP_NOT_WORDCHAR:
NULL on error or if no optimization possible
*/
-EXPORT pcre_extra *
+PCRE_DATA_SCOPE pcre_extra *
pcre_study(const pcre *external_re, int options, const char **errorptr)
{
uschar start_bits[32];
pcre_extra *extra;
pcre_study_data *study;
const uschar *tables;
-const real_pcre *re = (const real_pcre *)external_re;
-uschar *code = (uschar *)re + re->name_table_offset +
- (re->name_count * re->name_entry_size);
+uschar *code;
compile_data compile_block;
+const real_pcre *re = (const real_pcre *)external_re;
*errorptr = NULL;
return NULL;
}
+code = (uschar *)re + re->name_table_offset +
+ (re->name_count * re->name_entry_size);
+
/* For an anchored pattern, or an unanchored pattern that has a first char, or
a multiline pattern that matches only at "line starts", no further processing
at present. */