Commit cd51a734 authored by Joe Orton's avatar Joe Orton
Browse files

Move the POSIX reg* implementations into the ap_* namespace;

internalise the ap_reg*<->PCRE wrapper:

* configure.in: Add srclib/pcre to the include path.

* include/ap_regex.h: Renamed from include/pcreposix.h.  Prefix all
constants with AP_; prefix all functions and types with ap_.  Define
AP_DECLARE to nothing if necessary.  Remove regcomp error codes.

* include/httpd.h: Include ap_regex.h not pcreposix.h.
(ap_pregcomp, ap_regexec, ap_regfree): s/regex_t/ap_regex_t/.
(ap_regexec, ap_regerror): Prototypes moved to ap_regex.h.

* server/util.c (regex_cleanup, ap_pregcomp, ap_pregsub, ap_pregfree):
Adjust for ap_ prefixed types.  (ap_regexec, ap_regerror): Removed.

* server/Makefile.in: Build util_pcre.c.

* server/util_pcre.c: Copied from srclib/pcre/pcreposix.c; remove use
of PCRE-internals to do error mapping; rename types to add AP_/ap_
prefixes as above.  Use APR includes.  (ap_regerror): Use apr_snprintf.

* srclib/pcre/Makefile.in: Don't build pcreposix.c into libpcre.la.

* modules/*: Update to use new type and constant names.

PR: 27750 (part one)
Submitted by: Andres Salomon <dilinger voxel.net>, Joe Orton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/ssl@153384 13f79535-47bb-0310-9956-ffa450edef68
parent 3fcc319b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -126,24 +126,24 @@ static BOOL ssl_expr_eval_comp(request_rec *r, ssl_expr *node)
            ssl_expr *e1;
            ssl_expr *e2;
            char *word;
            regex_t *regex;
            ap_regex_t *regex;

            e1 = (ssl_expr *)node->node_arg1;
            e2 = (ssl_expr *)node->node_arg2;
            word = ssl_expr_eval_word(r, e1);
            regex = (regex_t *)(e2->node_arg1);
            regex = (ap_regex_t *)(e2->node_arg1);
            return (ap_regexec(regex, word, 0, NULL, 0) == 0);
        }
        case op_NRE: {
            ssl_expr *e1;
            ssl_expr *e2;
            char *word;
            regex_t *regex;
            ap_regex_t *regex;

            e1 = (ssl_expr *)node->node_arg1;
            e2 = (ssl_expr *)node->node_arg2;
            word = ssl_expr_eval_word(r, e1);
            regex = (regex_t *)(e2->node_arg1);
            regex = (ap_regex_t *)(e2->node_arg1);
            return !(ap_regexec(regex, word, 0, NULL, 0) == 0);
        }
        default: {
+4 −4
Original line number Diff line number Diff line
@@ -818,9 +818,9 @@ case 23:
case 24:
#line 148 "ssl_expr_parse.y"
{ 
                regex_t *regex;
                ap_regex_t *regex;
                if ((regex = ap_pregcomp(ssl_expr_info.pool, ssl_expr_yyvsp[0].cpVal, 
                                         REG_EXTENDED|REG_NOSUB)) == NULL) {
                                         AP_REG_EXTENDED|AP_REG_NOSUB)) == NULL) {
                    ssl_expr_error = "Failed to compile regular expression";
                    YYERROR;
                    regex = NULL;
@@ -831,9 +831,9 @@ case 24:
case 25:
#line 158 "ssl_expr_parse.y"
{
                regex_t *regex;
                ap_regex_t *regex;
                if ((regex = ap_pregcomp(ssl_expr_info.pool, ssl_expr_yyvsp[0].cpVal, 
                                         REG_EXTENDED|REG_NOSUB|REG_ICASE)) == NULL) {
                                         AP_REG_EXTENDED|AP_REG_NOSUB|AP_REG_ICASE)) == NULL) {
                    ssl_expr_error = "Failed to compile regular expression";
                    YYERROR;
                    regex = NULL;
+4 −4
Original line number Diff line number Diff line
@@ -112,18 +112,18 @@ word : T_DIGIT { $$ = ssl_expr_make(op_Digit, $1, NUL
          ;

regex     : T_REGEX { 
                regex_t *regex;
                ap_regex_t *regex;
                if ((regex = ap_pregcomp(ssl_expr_info.pool, $1, 
                                         REG_EXTENDED|REG_NOSUB)) == NULL) {
                                         AP_REG_EXTENDED|AP_REG_NOSUB)) == NULL) {
                    ssl_expr_error = "Failed to compile regular expression";
                    YYERROR;
                }
                $$ = ssl_expr_make(op_Regex, regex, NULL);
            }
          | T_REGEX_I {
                regex_t *regex;
                ap_regex_t *regex;
                if ((regex = ap_pregcomp(ssl_expr_info.pool, $1, 
                                         REG_EXTENDED|REG_NOSUB|REG_ICASE)) == NULL) {
                                         AP_REG_EXTENDED|AP_REG_NOSUB|AP_REG_ICASE)) == NULL) {
                    ssl_expr_error = "Failed to compile regular expression";
                    YYERROR;
                }