--- code/trunk/pcre_study.c 2007/02/24 21:41:42 93 +++ code/trunk/pcre_study.c 2008/04/20 17:10:13 342 @@ -6,7 +6,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel - Copyright (c) 1997-2006 University of Cambridge + Copyright (c) 1997-2008 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -42,6 +42,10 @@ supporting functions. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "pcre_internal.h" @@ -213,6 +217,13 @@ tcode += 1 + LINK_SIZE; break; + /* SKIPZERO skips the bracket. */ + + case OP_SKIPZERO: + do tcode += GET(tcode,1); while (*tcode == OP_ALT); + tcode += 1 + LINK_SIZE; + break; + /* Single-char * or ? sets the bit and tries the next item */ case OP_STAR: @@ -337,6 +348,7 @@ switch(tcode[1]) { case OP_ANY: + case OP_ALLANY: return SSB_FAIL; case OP_NOT_DIGIT: @@ -394,11 +406,13 @@ character with a value > 255. */ case OP_NCLASS: +#ifdef SUPPORT_UTF8 if (utf8) { start_bits[24] |= 0xf0; /* Bits for 0xc4 - 0xc8 */ memset(start_bits+25, 0xff, 7); /* Bits for 0xc9 - 0xff */ } +#endif /* Fall through */ case OP_CLASS: @@ -411,6 +425,7 @@ value is > 127. In fact, there are only two possible starting bytes for characters in the range 128 - 255. */ +#ifdef SUPPORT_UTF8 if (utf8) { for (c = 0; c < 16; c++) start_bits[c] |= tcode[c]; @@ -428,6 +443,7 @@ /* In non-UTF-8 mode, the two bit maps are completely compatible. */ else +#endif { for (c = 0; c < 32; c++) start_bits[c] |= tcode[c]; } @@ -487,7 +503,7 @@ NULL on error or if no optimization possible */ -PCRE_DATA_SCOPE pcre_extra * +PCRE_EXP_DEFN pcre_extra * pcre_study(const pcre *external_re, int options, const char **errorptr) { uschar start_bits[32]; @@ -519,7 +535,8 @@ a multiline pattern that matches only at "line starts", no further processing at present. */ -if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0) +if ((re->options & PCRE_ANCHORED) != 0 || + (re->flags & (PCRE_FIRSTSET|PCRE_STARTLINE)) != 0) return NULL; /* Set the character tables in the block that is passed around */