You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2003/07/16 01:30:40 UTC
cvs commit: httpd-2.0/modules/mappers mod_rewrite.c mod_rewrite.h
nd 2003/07/15 16:30:40
Modified: modules/mappers mod_rewrite.c mod_rewrite.h
Log:
optimization: no need to search linear for headers.
apr_table_get should be more efficient nearly always.
Revision Changes Path
1.160 +6 -17 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.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- mod_rewrite.c 15 Jul 2003 22:29:38 -0000 1.159
+++ mod_rewrite.c 15 Jul 2003 23:30:40 -0000 1.160
@@ -3961,27 +3961,16 @@
}
}
-static char *lookup_header(request_rec *r, const char *name)
+static const char *lookup_header(request_rec *r, const char *name)
{
- const apr_array_header_t *hdrs_arr;
- const apr_table_entry_t *hdrs;
- int i;
+ const char *val = apr_table_get(r->headers_in, name);
- hdrs_arr = apr_table_elts(r->headers_in);
- hdrs = (const apr_table_entry_t *)hdrs_arr->elts;
- for (i = 0; i < hdrs_arr->nelts; ++i) {
- if (hdrs[i].key == NULL) {
- continue;
- }
- if (strcasecmp(hdrs[i].key, name) == 0) {
- apr_table_merge(r->notes, VARY_KEY_THIS, name);
- return hdrs[i].val;
- }
+ if (val) {
+ apr_table_merge(r->notes, VARY_KEY_THIS, name);
}
- return NULL;
-}
-
+ return val;
+}
/*
1.44 +1 -1 httpd-2.0/modules/mappers/mod_rewrite.h
Index: mod_rewrite.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- mod_rewrite.h 1 Mar 2003 18:35:50 -0000 1.43
+++ mod_rewrite.h 15 Jul 2003 23:30:40 -0000 1.44
@@ -458,7 +458,7 @@
/* env variable support */
static char *lookup_variable(request_rec *r, char *var);
-static char *lookup_header(request_rec *r, const char *name);
+static const char *lookup_header(request_rec *r, const char *name);
/* caching functions */
static cache *init_cache(apr_pool_t *p);