]> granicus.if.org Git - apache/commitdiff
Merge r1744980 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 6 Jun 2016 19:11:04 +0000 (19:11 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 6 Jun 2016 19:11:04 +0000 (19:11 +0000)
Save a few bytes in the conf pool.

The directive's names don't need to be duplicated in this pool when parsing the configuration file.

Either they match a known directive name and we can use it directly if needed. Otherwise, it is still possible to make a copy afterwards.
Submitted by: jailletc36
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1747055 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/config.c

diff --git a/STATUS b/STATUS
index 8ac0a2d580d89f4b4208b0dbde311fca5b2a006c..505542423bf0b4458f1f113ff083035b5ab09381 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -115,11 +115,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
 
- *) core: save a few bytes in conf pool.
-     trunk patch: http://svn.apache.org/r1744980
-     2.4.x patch: trunk works
-     +1: jailletc36, icing, covener
-
  *) mod_rewrite: support new h2:// and h2c:// proxy url schemes in detection
      of absolute urls:
      trunk patch: http://svn.apache.org/r1744206
index bca8b53cfd52d62d0cc0dffcb20ffc90f187d829..2f652e8eec51787db0bb21b1da5afd4c7ae076e1 100644 (file)
@@ -1115,7 +1115,11 @@ static const char *ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
     args = ap_resolve_env(temp_pool, l);
 #endif
 
-    cmd_name = ap_getword_conf(p, &args);
+    /* The first word is the name of a directive.  We can safely use the
+     * 'temp_pool' for it.  If it matches the name of a known directive, we
+     * can reference the string within the module if needed.  Otherwise, we
+     * can still make a copy in the 'p' pool. */
+    cmd_name = ap_getword_conf(temp_pool, &args);
     if (*cmd_name == '\0') {
         /* Note: this branch should not occur. An empty line should have
          * triggered the exit further above.
@@ -1136,10 +1140,11 @@ static const char *ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
     newdir = apr_pcalloc(p, sizeof(ap_directive_t));
     newdir->filename = parms->config_file->name;
     newdir->line_num = parms->config_file->line_number;
-    newdir->directive = cmd_name;
     newdir->args = apr_pstrdup(p, args);
 
     if ((cmd = ap_find_command_in_modules(cmd_name, &mod)) != NULL) {
+        newdir->directive = cmd->name;
+        
         if (cmd->req_override & EXEC_ON_READ) {
             ap_directive_t *sub_tree = NULL;
 
@@ -1173,6 +1178,11 @@ static const char *ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
             return retval;
         }
     }
+    else {
+        /* No known directive found?  Make a copy of what we have parsed. */
+        newdir->directive = apr_pstrdup(p, cmd_name);
+    }
+
 
     if (cmd_name[0] == '<') {
         if (cmd_name[1] != '/') {