Don't pass 'large' objects by value when not needed, it wastes time and space.

Index: trunk/modules/cache/cache_util.c
===================================================================
--- trunk.orig/modules/cache/cache_util.c
+++ trunk/modules/cache/cache_util.c
@@ -28,40 +28,41 @@ extern module AP_MODULE_DECLARE_DATA cac
 /* Determine if "url" matches the hostname, scheme and port and path
  * in "filter". All but the path comparisons are case-insensitive.
  */
-static int uri_meets_conditions(apr_uri_t filter, int pathlen, apr_uri_t url)
+static int uri_meets_conditions(const apr_uri_t *filter, apr_size_t pathlen,
+                                const apr_uri_t *url)
 {
     /* Compare the hostnames */
-    if(filter.hostname) {
-        if (!url.hostname) {
+    if(filter->hostname) {
+        if (!url->hostname) {
             return 0;
         }
-        else if (strcasecmp(filter.hostname, url.hostname)) {
+        else if (strcasecmp(filter->hostname, url->hostname)) {
             return 0;
         }
     }
 
     /* Compare the schemes */
-    if(filter.scheme) {
-        if (!url.scheme) {
+    if(filter->scheme) {
+        if (!url->scheme) {
             return 0;
         }
-        else if (strcasecmp(filter.scheme, url.scheme)) {
+        else if (strcasecmp(filter->scheme, url->scheme)) {
             return 0;
         }
     }
 
     /* Compare the ports */
-    if(filter.port_str) {
-        if (url.port_str && filter.port != url.port) {
+    if(filter->port_str) {
+        if (url->port_str && filter->port != url->port) {
             return 0;
         }
         /* NOTE:  ap_port_of_scheme will return 0 if given NULL input */
-        else if (filter.port != apr_uri_port_of_scheme(url.scheme)) {
+        else if (filter->port != apr_uri_port_of_scheme(url->scheme)) {
             return 0;
         }
     }
-    else if(url.port_str && filter.scheme) {
-        if (apr_uri_port_of_scheme(filter.scheme) == url.port) {
+    else if(url->port_str && filter->scheme) {
+        if (apr_uri_port_of_scheme(filter->scheme) == url->port) {
             return 0;
         }
     }
@@ -69,12 +70,11 @@ static int uri_meets_conditions(apr_uri_
     /* Url has met all of the filter conditions so far, determine
      * if the paths match.
      */
-    return !strncmp(filter.path, url.path, pathlen);
+    return !strncmp(filter->path, url->path, pathlen);
 }
 
 CACHE_DECLARE(cache_provider_list *)ap_cache_get_providers(request_rec *r,
-                                                  cache_server_conf *conf,
-                                                  apr_uri_t uri)
+                                                  cache_server_conf *conf)
 {
     cache_provider_list *providers = NULL;
     int i;
@@ -83,7 +83,7 @@ CACHE_DECLARE(cache_provider_list *)ap_c
     for (i = 0; i < conf->cacheenable->nelts; i++) {
         struct cache_enable *ent =
                                 (struct cache_enable *)conf->cacheenable->elts;
-        if (uri_meets_conditions(ent[i].url, ent[i].pathlen, uri)) {
+        if (uri_meets_conditions(&ent[i].url, ent[i].pathlen, &r->parsed_uri)) 
{
             /* Fetch from global config and add to the list. */
             cache_provider *provider;
             provider = ap_lookup_provider(CACHE_PROVIDER_GROUP, ent[i].type,
@@ -120,7 +120,7 @@ CACHE_DECLARE(cache_provider_list *)ap_c
     for (i = 0; i < conf->cachedisable->nelts; i++) {
         struct cache_disable *ent =
                                (struct cache_disable 
*)conf->cachedisable->elts;
-        if (uri_meets_conditions(ent[i].url, ent[i].pathlen, uri)) {
+        if (uri_meets_conditions(&ent[i].url, ent[i].pathlen, &r->parsed_uri)) 
{
             /* Stop searching now. */
             return NULL;
         }
Index: trunk/modules/cache/mod_cache.c
===================================================================
--- trunk.orig/modules/cache/mod_cache.c
+++ trunk/modules/cache/mod_cache.c
@@ -106,7 +106,7 @@ static int cache_url_handler(request_rec
     /*
      * Which cache module (if any) should handle this request?
      */
-    if (!(providers = ap_cache_get_providers(r, conf, r->parsed_uri))) {
+    if (!(providers = ap_cache_get_providers(r, conf))) {
         return DECLINED;
     }
 
Index: trunk/modules/cache/mod_cache.h
===================================================================
--- trunk.orig/modules/cache/mod_cache.h
+++ trunk/modules/cache/mod_cache.h
@@ -280,7 +280,7 @@ CACHE_DECLARE(char *) ap_cache_generate_
                                              unsigned int *dirlevels,
                                              unsigned int *divisors,
                                              const char *name);
-CACHE_DECLARE(cache_provider_list *)ap_cache_get_providers(request_rec *r, 
cache_server_conf *conf, apr_uri_t uri);
+CACHE_DECLARE(cache_provider_list *)ap_cache_get_providers(request_rec *r, 
cache_server_conf *conf);
 CACHE_DECLARE(int) ap_cache_liststr(apr_pool_t *p, const char *list,
                                     const char *key, char **val);
 CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, 
const char **str);

--

Reply via email to