httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Thu, 24 Jul 2003 20:29:19 GMT
nd          2003/07/24 13:29:19

  Modified:    modules/mappers mod_rewrite.c
  Log:
  remove more variables from the stack and
  increase readability.
  
  Revision  Changes    Path
  1.172     +16 -25    httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.171
  retrieving revision 1.172
  diff -u -r1.171 -r1.172
  --- mod_rewrite.c	24 Jul 2003 19:50:45 -0000	1.171
  +++ mod_rewrite.c	24 Jul 2003 20:29:19 -0000	1.172
  @@ -576,9 +576,7 @@
       char *a1;
       char *a2;
       char *a3;
  -    char *cp;
       const char *err;
  -    int rc;
   
       sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
   
  @@ -612,26 +610,21 @@
   
       /*  arg2: the pattern
           try to compile the regexp to test if is ok */
  -    cp = a2;
  -    if (cp[0] == '!') {
  +    if (*a2 == '!') {
           newcond->flags |= CONDFLAG_NOTMATCH;
  -        cp++;
  +        ++a2;
       }
   
  -    if (newcond->flags & CONDFLAG_NOCASE) {
  -        rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED|REG_ICASE))
  -              == NULL);
  -    }
  -    else {
  -        rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED)) == NULL);
  -    }
  -    if (rc) {
  +    regexp = ap_pregcomp(cmd->pool, a2, REG_EXTENDED |
  +                                        ((newcond->flags & CONDFLAG_NOCASE)
  +                                         ? REG_ICASE : 0));
  +    if (!regexp) {
           return apr_pstrcat(cmd->pool,
                              "RewriteCond: cannot compile regular expression '",
                              a2, "'", NULL);
       }
   
  -    newcond->pattern = apr_pstrdup(cmd->pool, cp);
  +    newcond->pattern = apr_pstrdup(cmd->pool, a2);
       newcond->regexp  = regexp;
   
       return NULL;
  @@ -667,9 +660,7 @@
       char *a1;
       char *a2;
       char *a3;
  -    char *cp;
       const char *err;
  -    int mode;
   
       sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
   
  @@ -704,21 +695,21 @@
       /*  arg1: the pattern
        *  try to compile the regexp to test if is ok
        */
  -    cp = a1;
  -    if (cp[0] == '!') {
  +    if (*a1 == '!') {
           newrule->flags |= RULEFLAG_NOTMATCH;
  -        cp++;
  +        ++a1;
       }
  -    mode = REG_EXTENDED;
  -    if (newrule->flags & RULEFLAG_NOCASE) {
  -        mode |= REG_ICASE;
  -    }
  -    if ((regexp = ap_pregcomp(cmd->pool, cp, mode)) == NULL) {
  +
  +    regexp = ap_pregcomp(cmd->pool, a1, REG_EXTENDED |
  +                                        ((newrule->flags & RULEFLAG_NOCASE)
  +                                         ? REG_ICASE : 0));
  +    if (!regexp) {
           return apr_pstrcat(cmd->pool,
                              "RewriteRule: cannot compile regular expression '",
                              a1, "'", NULL);
       }
  -    newrule->pattern = apr_pstrdup(cmd->pool, cp);
  +
  +    newrule->pattern = apr_pstrdup(cmd->pool, a1);
       newrule->regexp  = regexp;
   
       /*  arg2: the output string */
  
  
  

Mime
View raw message