]> granicus.if.org Git - apache/commitdiff
Small speed optimization when parsing <Limit>, <LimitExcept> and environment variables
authorChristophe Jaillet <jailletc36@apache.org>
Tue, 2 Jun 2015 05:40:57 +0000 (05:40 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Tue, 2 Jun 2015 05:40:57 +0000 (05:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1683044 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index 7138444070d112564bfcdced202bc1e329b5bc3c..4d1a4aa07256960a5734fc567182c948e03477ed 100644 (file)
@@ -1263,8 +1263,8 @@ AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word)
         }
 
         if (*s == '$') {
-            if (s[1] == '{' && (e = ap_strchr_c(s, '}'))) {
-                char *name = apr_pstrndup(p, s+2, e-s-2);
+            if (s[1] == '{' && (e = ap_strchr_c(s+2, '}'))) {
+                char *name = apr_pstrmemdup(p, s+2, e-s-2);
                 word = NULL;
                 if (server_config_defined_vars)
                     word = apr_table_get(server_config_defined_vars, name);
@@ -2147,7 +2147,7 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,
         return unclosed_directive(cmd);
     }
 
-    limited_methods = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
+    limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);
 
     if (!limited_methods[0]) {
         return missing_container_arg(cmd);
@@ -2164,7 +2164,7 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,
             return "TRACE cannot be controlled by <Limit>, see TraceEnable";
         }
         else if (methnum == M_INVALID) {
-            /* method has not been registered yet, but resorce restriction
+            /* method has not been registered yet, but resource restriction
              * is always checked before method handling, so register it.
              */
             methnum = ap_method_register(cmd->pool,