summaryrefslogtreecommitdiffstats
path: root/server/util_script.c
diff options
context:
space:
mode:
authorBrian Pane <brianp@apache.org>2001-11-24 05:22:45 +0100
committerBrian Pane <brianp@apache.org>2001-11-24 05:22:45 +0100
commit38b27b0333e92fefab5dbc7729a164fc6c23ace1 (patch)
treee4c5d3af20acf7e81fae72887f9afabaea8c1155 /server/util_script.c
parentdon't bother setting the ssl info callback unless SSLLogLevel >= info (diff)
downloadapache2-38b27b0333e92fefab5dbc7729a164fc6c23ace1.tar.xz
apache2-38b27b0333e92fefab5dbc7729a164fc6c23ace1.zip
optimize ap_add_common_vars() for the common case where r->subprocess_env is empty
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92152 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_script.c')
-rw-r--r--server/util_script.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/util_script.c b/server/util_script.c
index 669e283183..61d85d902c 100644
--- a/server/util_script.c
+++ b/server/util_script.c
@@ -176,8 +176,15 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
/* use a temporary apr_table_t which we'll overlap onto
* r->subprocess_env later
+ * (exception: if r->subprocess_env is empty at the start,
+ * write directly into it)
*/
- e = apr_table_make(r->pool, 25 + hdrs_arr->nelts);
+ if (apr_is_empty_table(r->subprocess_env)) {
+ e = r->subprocess_env;
+ }
+ else {
+ e = apr_table_make(r->pool, 25 + hdrs_arr->nelts);
+ }
/* First, add environment vars from headers... this is as per
* CGI specs, though other sorts of scripting interfaces see
@@ -297,7 +304,9 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
}
}
- apr_table_overlap(r->subprocess_env, e, APR_OVERLAP_TABLES_SET);
+ if (e != r->subprocess_env) {
+ apr_table_overlap(r->subprocess_env, e, APR_OVERLAP_TABLES_SET);
+ }
}
/* This "cute" little function comes about because the path info on