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 Mon, 28 Jul 2003 21:59:43 GMT
nd          2003/07/28 14:59:43

  Modified:    modules/mappers mod_rewrite.c
  Log:
  cleanup splitout_queryargs function.
  - don't compute strlen more than one time
  - use ap_strchr instead of strchr
  
  Revision  Changes    Path
  1.194     +13 -11    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.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- mod_rewrite.c	28 Jul 2003 21:31:06 -0000	1.193
  +++ mod_rewrite.c	28 Jul 2003 21:59:43 -0000	1.194
  @@ -661,7 +661,6 @@
   static void splitout_queryargs(request_rec *r, int qsappend)
   {
       char *q;
  -    char *olduri;
   
       /* don't touch, unless it's an http or mailto URL.
        * See RFC 1738 and RFC 2368.
  @@ -673,8 +672,11 @@
           return;
       }
   
  -    q = strchr(r->filename, '?');
  +    q = ap_strchr(r->filename, '?');
       if (q != NULL) {
  +        char *olduri;
  +        apr_size_t len;
  +
           olduri = apr_pstrdup(r->pool, r->filename);
           *q++ = '\0';
           if (qsappend) {
  @@ -683,18 +685,17 @@
           else {
               r->args = apr_pstrdup(r->pool, q);
           }
  -        if (strlen(r->args) == 0) {
  +
  +        len = strlen(r->args);
  +        if (!len) {
               r->args = NULL;
  -            rewritelog(r, 3, "split uri=%s -> uri=%s, args=<none>", olduri,
  -                       r->filename);
           }
  -        else {
  -            if (r->args[strlen(r->args)-1] == '&') {
  -                r->args[strlen(r->args)-1] = '\0';
  -            }
  -            rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri,
  -                       r->filename, r->args);
  +        else if (r->args[len-1] == '&') {
  +            r->args[len-1] = '\0';
           }
  +
  +        rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri,
  +                   r->filename, r->args ? r->args : "<none>");
       }
   
       return;
  @@ -758,6 +759,7 @@
               r->filename = apr_pstrdup(r->pool, url);
           }
       }
  +
       return;
   }
   
  
  
  

Mime
View raw message