mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order to save a few cycles.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1719018 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -46,6 +46,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
|
|||||||
ap_rxplus_t *ret = apr_pcalloc(pool, sizeof(ap_rxplus_t));
|
ap_rxplus_t *ret = apr_pcalloc(pool, sizeof(ap_rxplus_t));
|
||||||
char delim = 0;
|
char delim = 0;
|
||||||
enum { SUBSTITUTE = 's', MATCH = 'm'} action = MATCH;
|
enum { SUBSTITUTE = 's', MATCH = 'm'} action = MATCH;
|
||||||
|
|
||||||
if (!apr_isalnum(pattern[0])) {
|
if (!apr_isalnum(pattern[0])) {
|
||||||
delim = *str++;
|
delim = *str++;
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We have a delimiter. Use it to extract the regexp */
|
/* We have a delimiter. Use it to extract the regexp */
|
||||||
rxstr = apr_pstrndup(pool, str, endp-str);
|
rxstr = apr_pstrmemdup(pool, str, endp-str);
|
||||||
|
|
||||||
/* If it's a substitution, we need the replacement string
|
/* If it's a substitution, we need the replacement string
|
||||||
* TODO: possible future enhancement - support other parsing
|
* TODO: possible future enhancement - support other parsing
|
||||||
@@ -89,7 +90,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool,
|
|||||||
/* missing replacement string is an error */
|
/* missing replacement string is an error */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret->subs = apr_pstrndup(pool, str, (endp-str));
|
ret->subs = apr_pstrmemdup(pool, str, endp-str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* anything after the current delimiter is flags */
|
/* anything after the current delimiter is flags */
|
||||||
|
Reference in New Issue
Block a user