diff options
Diffstat (limited to 'ext/pcre/pcrelib/pcre_compile.c')
-rw-r--r-- | ext/pcre/pcrelib/pcre_compile.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c index 0f3ebf93fd..99b230e433 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,6 +1448,8 @@ for (;;) if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f]; break; } +#else + (void)(utf8); /* Keep compiler happy by referencing function argument */ #endif } } @@ -1541,6 +1543,8 @@ for (;;) if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f]; break; } +#else + (void)(utf8); /* Keep compiler happy by referencing function argument */ #endif } } @@ -2013,7 +2017,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 = _pcre_ucp_othercase(c)) != NOTACHAR) break; } + { if ((othercase = UCD_OTHERCASE(c)) != c) break; } if (c > d) return FALSE; @@ -2022,7 +2026,7 @@ next = othercase + 1; for (++c; c <= d; c++) { - if (_pcre_ucp_othercase(c) != next) break; + if (UCD_OTHERCASE(c) != next) break; next++; } @@ -2132,6 +2136,8 @@ 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; @@ -2150,7 +2156,7 @@ if (next >= 0) switch(op_code) unsigned int othercase; if (next < 128) othercase = cd->fcc[next]; else #ifdef SUPPORT_UCP - othercase = _pcre_ucp_othercase((unsigned int)next); + othercase = UCD_OTHERCASE((unsigned int)next); #else othercase = NOTACHAR; #endif @@ -2171,7 +2177,7 @@ if (next >= 0) switch(op_code) unsigned int othercase; if (next < 128) othercase = cd->fcc[next]; else #ifdef SUPPORT_UCP - othercase = _pcre_ucp_othercase(next); + othercase = UCD_OTHERCASE(next); #else othercase = NOTACHAR; #endif @@ -3337,7 +3343,7 @@ for (;; ptr++) if ((options & PCRE_CASELESS) != 0) { unsigned int othercase; - if ((othercase = _pcre_ucp_othercase(c)) != NOTACHAR) + if ((othercase = UCD_OTHERCASE(c)) != c) { *class_utf8data++ = XCL_SINGLE; class_utf8data += _pcre_ord2utf8(othercase, class_utf8data); @@ -4214,7 +4220,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 */ @@ -4918,10 +4924,8 @@ 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. 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. */ + options if this setting actually changes any of them, and reset the + greedy defaults and the case value for firstbyte and reqbyte. */ if (*ptr == ')') { @@ -4929,7 +4933,6 @@ 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 { @@ -4938,17 +4941,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 = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0; + req_caseopt = ((newoptions & 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 */ } @@ -5942,7 +5945,7 @@ Returns: pointer to compiled data block, or NULL on error, with errorptr and erroroffset set */ -PCRE_EXP_DEFN pcre * +PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION pcre_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables) { @@ -5950,7 +5953,7 @@ return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables); } -PCRE_EXP_DEFN pcre * +PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION pcre_compile2(const char *pattern, int options, int *errorcodeptr, const char **errorptr, int *erroroffset, const unsigned char *tables) { |