diff options
Diffstat (limited to 'ext/pcre/pcrelib/pcre_compile.c')
-rw-r--r-- | ext/pcre/pcrelib/pcre_compile.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c index 99b230e433..0f3ebf93fd 100644 --- a/ext/pcre/pcrelib/pcre_compile.c +++ b/ext/pcre/pcrelib/pcre_compile.c @@ -453,7 +453,7 @@ static const char * find_error_text(int n) { const char *s = error_texts; -for (; n > 0; n--) while (*s++ != 0) {}; +for (; n > 0; n--) while (*s++ != 0); return s; } @@ -1000,7 +1000,7 @@ for (; *ptr != 0; ptr++) if (*(++ptr) == 0) return -1; if (*ptr == 'Q') for (;;) { - while (*(++ptr) != 0 && *ptr != '\\') {}; + while (*(++ptr) != 0 && *ptr != '\\'); if (*ptr == 0) return -1; if (*(++ptr) == 'E') break; } @@ -1043,7 +1043,7 @@ for (; *ptr != 0; ptr++) if (*(++ptr) == 0) return -1; if (*ptr == 'Q') for (;;) { - while (*(++ptr) != 0 && *ptr != '\\') {}; + while (*(++ptr) != 0 && *ptr != '\\'); if (*ptr == 0) return -1; if (*(++ptr) == 'E') break; } @@ -1057,7 +1057,7 @@ for (; *ptr != 0; ptr++) if (xmode && *ptr == '#') { - while (*(++ptr) != 0 && *ptr != '\n') {}; + while (*(++ptr) != 0 && *ptr != '\n'); if (*ptr == 0) return -1; continue; } @@ -1448,8 +1448,6 @@ for (;;) if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f]; break; } -#else - (void)(utf8); /* Keep compiler happy by referencing function argument */ #endif } } @@ -1543,8 +1541,6 @@ for (;;) if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f]; break; } -#else - (void)(utf8); /* Keep compiler happy by referencing function argument */ #endif } } @@ -2017,7 +2013,7 @@ get_othercase_range(unsigned int *cptr, unsigned int d, unsigned int *ocptr, unsigned int c, othercase, next; for (c = *cptr; c <= d; c++) - { if ((othercase = UCD_OTHERCASE(c)) != c) break; } + { if ((othercase = _pcre_ucp_othercase(c)) != NOTACHAR) break; } if (c > d) return FALSE; @@ -2026,7 +2022,7 @@ next = othercase + 1; for (++c; c <= d; c++) { - if (UCD_OTHERCASE(c) != next) break; + if (_pcre_ucp_othercase(c) != next) break; next++; } @@ -2136,8 +2132,6 @@ if (next >= 0) switch(op_code) case OP_CHAR: #ifdef SUPPORT_UTF8 if (utf8 && item > 127) { GETCHAR(item, utf8_char); } -#else - (void)(utf8_char); /* Keep compiler happy by referencing function argument */ #endif return item != next; @@ -2156,7 +2150,7 @@ if (next >= 0) switch(op_code) unsigned int othercase; if (next < 128) othercase = cd->fcc[next]; else #ifdef SUPPORT_UCP - othercase = UCD_OTHERCASE((unsigned int)next); + othercase = _pcre_ucp_othercase((unsigned int)next); #else othercase = NOTACHAR; #endif @@ -2177,7 +2171,7 @@ if (next >= 0) switch(op_code) unsigned int othercase; if (next < 128) othercase = cd->fcc[next]; else #ifdef SUPPORT_UCP - othercase = UCD_OTHERCASE(next); + othercase = _pcre_ucp_othercase(next); #else othercase = NOTACHAR; #endif @@ -3343,7 +3337,7 @@ for (;; ptr++) if ((options & PCRE_CASELESS) != 0) { unsigned int othercase; - if ((othercase = UCD_OTHERCASE(c)) != c) + if ((othercase = _pcre_ucp_othercase(c)) != NOTACHAR) { *class_utf8data++ = XCL_SINGLE; class_utf8data += _pcre_ord2utf8(othercase, class_utf8data); @@ -4220,7 +4214,7 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */ const char *vn = verbnames; const uschar *name = ++ptr; previous = NULL; - while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {}; + while ((cd->ctypes[*++ptr] & ctype_letter) != 0); if (*ptr == ':') { *errorcodeptr = ERR59; /* Not supported */ @@ -4924,8 +4918,10 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */ both phases. If we are not at the pattern start, compile code to change the ims - options if this setting actually changes any of them, and reset the - greedy defaults and the case value for firstbyte and reqbyte. */ + options if this setting actually changes any of them. We also pass the + new setting back so that it can be put at the start of any following + branches, and when this group ends (if we are in a group), a resetting + item can be compiled. */ if (*ptr == ')') { @@ -4933,6 +4929,7 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */ (lengthptr == NULL || *lengthptr == 2 + 2*LINK_SIZE)) { cd->external_options = newoptions; + options = *optionsptr = newoptions; } else { @@ -4941,17 +4938,17 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */ *code++ = OP_OPT; *code++ = newoptions & PCRE_IMS; } + + /* Change options at this level, and pass them back for use + in subsequent branches. Reset the greedy defaults and the case + value for firstbyte and reqbyte. */ + + *optionsptr = options = newoptions; greedy_default = ((newoptions & PCRE_UNGREEDY) != 0); greedy_non_default = greedy_default ^ 1; - req_caseopt = ((newoptions & PCRE_CASELESS) != 0)? REQ_CASELESS : 0; + req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0; } - /* Change options at this level, and pass them back for use - in subsequent branches. When not at the start of the pattern, this - information is also necessary so that a resetting item can be - compiled at the end of a group (if we are in a group). */ - - *optionsptr = options = newoptions; previous = NULL; /* This item can't be repeated */ continue; /* It is complete */ } @@ -5945,7 +5942,7 @@ Returns: pointer to compiled data block, or NULL on error, with errorptr and erroroffset set */ -PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION +PCRE_EXP_DEFN pcre * pcre_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables) { @@ -5953,7 +5950,7 @@ return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables); } -PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION +PCRE_EXP_DEFN pcre * pcre_compile2(const char *pattern, int options, int *errorcodeptr, const char **errorptr, int *erroroffset, const unsigned char *tables) { |