httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1719018 - /httpd/httpd/trunk/server/util_regex.c
Date Thu, 10 Dec 2015 06:52:10 GMT
Author: jailletc36
Date: Thu Dec 10 06:52:10 2015
New Revision: 1719018

URL: http://svn.apache.org/viewvc?rev=1719018&view=rev
Log:
Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order to save a few cycles.

Modified:
    httpd/httpd/trunk/server/util_regex.c

Modified: httpd/httpd/trunk/server/util_regex.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_regex.c?rev=1719018&r1=1719017&r2=1719018&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_regex.c (original)
+++ httpd/httpd/trunk/server/util_regex.c Thu Dec 10 06:52:10 2015
@@ -46,6 +46,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compi
     ap_rxplus_t *ret = apr_pcalloc(pool, sizeof(ap_rxplus_t));
     char delim = 0;
     enum { SUBSTITUTE = 's', MATCH = 'm'} action = MATCH;
+
     if (!apr_isalnum(pattern[0])) {
         delim = *str++;
     }
@@ -65,7 +66,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compi
     if (delim) {
         endp = ap_strchr_c(str, delim);
     }
-    if (!endp) { /* there's no delim  or flags */
+    if (!endp) { /* there's no delim or flags */
         if (ap_regcomp(&ret->rx, pattern, 0) == 0) {
             apr_pool_cleanup_register(pool, &ret->rx, rxplus_cleanup,
                                       apr_pool_cleanup_null);
@@ -77,7 +78,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compi
     }
 
     /* 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
      * TODO: possible future enhancement - support other parsing
@@ -89,7 +90,7 @@ AP_DECLARE(ap_rxplus_t*) ap_rxplus_compi
             /* missing replacement string is an error */
             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 */



Mime
View raw message