summaryrefslogtreecommitdiffstats
path: root/server/util_pcre.c
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@apache.org>2014-01-03 23:26:55 +0100
committerGraham Leggett <minfrin@apache.org>2014-01-03 23:26:55 +0100
commit4fecd089c47b466a78161adc5e24915bfdd317ad (patch)
tree7ffa54fcf89348b92334326dd3c854173b09d11a /server/util_pcre.c
parentAllocate correct size for the array to avoid useless memory allocation and copy (diff)
downloadapache2-4fecd089c47b466a78161adc5e24915bfdd317ad.tar.xz
apache2-4fecd089c47b466a78161adc5e24915bfdd317ad.zip
Add a "MATCH_" prefix to variables set within
LocationMatch/DirectoryMatch/FilesMatch. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1555266 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_pcre.c')
-rw-r--r--server/util_pcre.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/util_pcre.c b/server/util_pcre.c
index 41761487e4..4d2adef25b 100644
--- a/server/util_pcre.c
+++ b/server/util_pcre.c
@@ -258,7 +258,8 @@ AP_DECLARE(int) ap_regexec_len(const ap_regex_t *preg, const char *buff,
}
AP_DECLARE(int) ap_regname(const ap_regex_t *preg,
- apr_array_header_t *names, int upper)
+ apr_array_header_t *names, const char *prefix,
+ int upper)
{
int namecount;
int nameentrysize;
@@ -278,10 +279,14 @@ AP_DECLARE(int) ap_regname(const ap_regex_t *preg,
while (names->nelts <= capture) {
apr_array_push(names);
}
- if (upper) {
- char *name = ((char **)names->elts)[capture] =
- apr_pstrdup(names->pool, offset + 2);
- ap_str_toupper(name);
+ if (upper || prefix) {
+ char *name = ((char **) names->elts)[capture] =
+ prefix ? apr_pstrcat(names->pool, prefix, offset + 2,
+ NULL) :
+ apr_pstrdup(names->pool, offset + 2);
+ if (upper) {
+ ap_str_toupper(name);
+ }
}
else {
((const char **)names->elts)[capture] = offset + 2;