]> granicus.if.org Git - apache/commitdiff
Save a few bytes in conf pool when processing 'Define'.
authorChristophe Jaillet <jailletc36@apache.org>
Fri, 6 Nov 2015 21:59:53 +0000 (21:59 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Fri, 6 Nov 2015 21:59:53 +0000 (21:59 +0000)
+ some minor style issues
+ split long lines

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1713043 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index b3f622db601ffab15001627b49d30661d43495fe..a2d54d08527b6e9f9a775aeaa9a1c8eefd993db5 100644 (file)
@@ -1361,21 +1361,25 @@ static const char *set_define(cmd_parms *cmd, void *dummy,
                               const char *name, const char *value)
 {
     if (cmd->parent && strcasecmp(cmd->parent->directive, "<VirtualHost")) { 
-        return apr_pstrcat(cmd->pool, cmd->cmd->name, " is not valid in ", cmd->parent->directive, " context", NULL);
+        return apr_pstrcat(cmd->pool, cmd->cmd->name, " is not valid in ",
+                                      cmd->parent->directive, " context", NULL);
     }
 
-    if (ap_strchr_c(name, ':') != NULL)
+    if (ap_strchr_c(name, ':') != NULL) {
         return "Variable name must not contain ':'";
+    }
 
-    if (!saved_server_config_defines)
+    if (!saved_server_config_defines) {
         init_config_defines(cmd->pool);
+    }
     if (!ap_exists_config_define(name)) {
-        char **newv = (char **)apr_array_push(ap_server_config_defines);
-        *newv = apr_pstrdup(cmd->pool, name);
+        const char **newv = (const char **)apr_array_push(ap_server_config_defines);
+        *newv = name;
     }
     if (value) {
-        if (!server_config_defined_vars)
+        if (!server_config_defined_vars) {
             server_config_defined_vars = apr_table_make(cmd->pool, 5);
+        }
         apr_table_setn(server_config_defined_vars, name, value);
     }
 
@@ -1388,14 +1392,17 @@ static const char *unset_define(cmd_parms *cmd, void *dummy,
     int i;
     char **defines;
     if (cmd->parent && strcasecmp(cmd->parent->directive, "<VirtualHost")) { 
-        return apr_pstrcat(cmd->pool, cmd->cmd->name, " is not valid in ", cmd->parent->directive, " context", NULL);
+        return apr_pstrcat(cmd->pool, cmd->cmd->name, " is not valid in ",
+                                      cmd->parent->directive, " context", NULL);
     }
 
-    if (ap_strchr_c(name, ':') != NULL)
+    if (ap_strchr_c(name, ':') != NULL) {
         return "Variable name must not contain ':'";
+    }
 
-    if (!saved_server_config_defines)
+    if (!saved_server_config_defines) {
         init_config_defines(cmd->pool);
+    }
 
     defines = (char **)ap_server_config_defines->elts;
     for (i = 0; i < ap_server_config_defines->nelts; i++) {