httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1744980 - /httpd/httpd/trunk/server/config.c
Date Sat, 21 May 2016 20:39:59 GMT
Author: jailletc36
Date: Sat May 21 20:39:59 2016
New Revision: 1744980

URL: http://svn.apache.org/viewvc?rev=1744980&view=rev
Log:
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.

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

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1744980&r1=1744979&r2=1744980&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Sat May 21 20:39:59 2016
@@ -1122,7 +1122,11 @@ static const char *ap_build_config_sub(a
     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.
@@ -1143,10 +1147,11 @@ static const char *ap_build_config_sub(a
     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;
 
@@ -1180,6 +1185,11 @@ static const char *ap_build_config_sub(a
             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] != '/') {



Mime
View raw message