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 Sun, 27 Jul 2003 11:56:07 GMT
nd          2003/07/27 04:56:06

  Modified:    modules/mappers mod_rewrite.c
  Log:
  avoid unnecessary memory operations
  
  Revision  Changes    Path
  1.183     +18 -18    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.182
  retrieving revision 1.183
  diff -u -r1.182 -r1.183
  --- mod_rewrite.c	27 Jul 2003 00:08:21 -0000	1.182
  +++ mod_rewrite.c	27 Jul 2003 11:56:06 -0000	1.183
  @@ -1158,43 +1158,43 @@
    * +-------------------------------------------------------+
    */
   
  +/*
  + * General Note: key is already a fresh string, created (expanded) just
  + * for the purpose to be passed in here. So one can modify key itself.
  + */
  +
   static char *rewrite_mapfunc_toupper(request_rec *r, char *key)
   {
  -    char *value, *cp;
  +    char *p;
   
  -    for (cp = value = apr_pstrdup(r->pool, key); cp != NULL && *cp != '\0';
  -         cp++) {
  -        *cp = apr_toupper(*cp);
  +    for (p = key; *p; ++p) {
  +        *p = apr_toupper(*p);
       }
  -    return value;
  +
  +    return key;
   }
   
   static char *rewrite_mapfunc_tolower(request_rec *r, char *key)
   {
  -    char *value, *cp;
  +    char *p;
   
  -    for (cp = value = apr_pstrdup(r->pool, key); cp != NULL && *cp != '\0';
  -         cp++) {
  -        *cp = apr_tolower(*cp);
  +    for (p = key; *p; ++p) {
  +        *p = apr_tolower(*p);
       }
  -    return value;
  +
  +    return key;
   }
   
   static char *rewrite_mapfunc_escape(request_rec *r, char *key)
   {
  -    char *value;
  -
  -    value = ap_escape_uri(r->pool, key);
  -    return value;
  +    return ap_escape_uri(r->pool, key);
   }
   
   static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
   {
  -    char *value;
  +    ap_unescape_url(key);
   
  -    value = apr_pstrdup(r->pool, key);
  -    ap_unescape_url(value);
  -    return value;
  +    return key;
   }
   
   static void rewrite_rand_init(void)
  
  
  

Mime
View raw message