You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2012/08/14 22:57:44 UTC

svn commit: r1373092 - in /httpd/httpd/branches/2.4.x: ./ modules/aaa/ modules/http/ modules/lua/ modules/proxy/ modules/session/ server/

Author: jim
Date: Tue Aug 14 20:57:43 2012
New Revision: 1373092

URL: http://svn.apache.org/viewvc?rev=1373092&view=rev
Log:
Merge r1361801 from trunk:

Various code clean up

Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 52893 

Submitted by: sf
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_core.c
    httpd/httpd/branches/2.4.x/modules/http/http_protocol.c
    httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c
    httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_ftp.c
    httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
    httpd/httpd/branches/2.4.x/modules/session/mod_session.c
    httpd/httpd/branches/2.4.x/server/core.c
    httpd/httpd/branches/2.4.x/server/provider.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1361801

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue Aug 14 20:57:43 2012
@@ -93,13 +93,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.4.x patch: trunk patch works
      +1: rjung, humbedooh, trawick (needs CHANGES entry)
 
-   * Various code clean up.
-     Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
-     PR: 52893
-     trunk patch: http://svn.apache.org/viewvc?view=rev&rev=1361801
-     2.4.x patch: trunk patch works, except for mod_policy (ignore)
-     +1: rjung, trawick, jim
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

Modified: httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_core.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_core.c (original)
+++ httpd/httpd/branches/2.4.x/modules/aaa/mod_authz_core.c Tue Aug 14 20:57:43 2012
@@ -629,12 +629,9 @@ static int authz_core_check_section(apr_
 
     if (ret != OK) {
         ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, APR_SUCCESS, s, APLOGNO(01624)
-                     "%s",
-                     apr_pstrcat(p, (is_conf
-                                     ? "<Directory>, <Location>, or similar"
-                                     : format_authz_command(p, section)),
-                                 " directive contains only negative "
-                                 "authorization directives", NULL));
+                     "%s directive contains only negative authorization directives",
+                     is_conf ? "<Directory>, <Location>, or similar"
+                             : format_authz_command(p, section));
     }
 
     return ret;

Modified: httpd/httpd/branches/2.4.x/modules/http/http_protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http/http_protocol.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http/http_protocol.c (original)
+++ httpd/httpd/branches/2.4.x/modules/http/http_protocol.c Tue Aug 14 20:57:43 2012
@@ -799,11 +799,9 @@ AP_DECLARE(const char *) ap_get_status_l
 }
 
 /* Build the Allow field-value from the request handler method mask.
- * Note that we always allow TRACE, since it is handled below.
  */
 static char *make_allow(request_rec *r)
 {
-    char *list;
     apr_int64_t mask;
     apr_array_header_t *allow = apr_array_make(r->pool, 10, sizeof(char *));
     apr_hash_index_t *hi = apr_hash_first(r->pool, methods_registry);
@@ -831,25 +829,15 @@ static char *make_allow(request_rec *r)
     if (conf->trace_enable != AP_TRACE_DISABLE)
         *(const char **)apr_array_push(allow) = "TRACE";
 
-    list = apr_array_pstrcat(r->pool, allow, ',');
-
     /* ### this is rather annoying. we should enforce registration of
        ### these methods */
     if ((mask & (AP_METHOD_BIT << M_INVALID))
         && (r->allowed_methods->method_list != NULL)
         && (r->allowed_methods->method_list->nelts != 0)) {
-        int i;
-        char **xmethod = (char **) r->allowed_methods->method_list->elts;
-
-        /*
-         * Append all of the elements of r->allowed_methods->method_list
-         */
-        for (i = 0; i < r->allowed_methods->method_list->nelts; ++i) {
-            list = apr_pstrcat(r->pool, list, ",", xmethod[i], NULL);
-        }
+        apr_array_cat(allow, r->allowed_methods->method_list);
     }
 
-    return list;
+    return apr_array_pstrcat(r->pool, allow, ',');
 }
 
 AP_DECLARE(int) ap_send_http_options(request_rec *r)

Modified: httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c (original)
+++ httpd/httpd/branches/2.4.x/modules/lua/mod_lua.c Tue Aug 14 20:57:43 2012
@@ -456,16 +456,15 @@ static const char *register_named_block_
 
     {
         cr_ctx ctx;
-        char buf[32];
         lua_State *lvm;
         char *tmp;
         int rv;
         ap_directive_t **current;
         hack_section_baton *baton;
 
-        apr_snprintf(buf, sizeof(buf), "%u", cmd->config_file->line_number);
-        spec->file_name = apr_pstrcat(cmd->pool, cmd->config_file->name, ":",
-                                      buf, NULL);
+        spec->file_name = apr_psprintf(cmd->pool, "%s:%u",
+                                       cmd->config_file->name,
+                                       cmd->config_file->line_number);
         if (function) {
             spec->function_name = (char *) function;
         }

Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_ftp.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_ftp.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_ftp.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_ftp.c Tue Aug 14 20:57:43 2012
@@ -1725,7 +1725,7 @@ static int proxy_ftp_handler(request_rec
         if (len != 0)
             buf = apr_pstrcat(p, "LIST ", path, CRLF, NULL);
         else if (cwd == NULL || strchr(cwd, '/') != NULL)
-            buf = apr_pstrcat(p, "LIST -lag", CRLF, NULL);
+            buf = "LIST -lag" CRLF;
         else
             buf = "LIST" CRLF;
     }

Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Tue Aug 14 20:57:43 2012
@@ -373,7 +373,7 @@ PROXY_DECLARE(int) ap_proxyerror(request
             NULL));
 
     /* Allow "error-notes" string to be printed by ap_send_error_response() */
-    apr_table_setn(r->notes, "verbose-error-to", apr_pstrdup(r->pool, "*"));
+    apr_table_setn(r->notes, "verbose-error-to", "*");
 
     r->status_line = apr_psprintf(r->pool, "%3.3u Proxy Error", statuscode);
     ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00898) "%s returned by %s", message,

Modified: httpd/httpd/branches/2.4.x/modules/session/mod_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/session/mod_session.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/session/mod_session.c (original)
+++ httpd/httpd/branches/2.4.x/modules/session/mod_session.c Tue Aug 14 20:57:43 2012
@@ -373,7 +373,7 @@ static apr_status_t session_identity_dec
     }
 
     /* decode what we have */
-    encoded = apr_pstrcat(r->pool, z->encoded, NULL);
+    encoded = apr_pstrdup(r->pool, z->encoded);
     pair = apr_strtok(encoded, sep, &last);
     while (pair && pair[0]) {
         char *plast = NULL;

Modified: httpd/httpd/branches/2.4.x/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/core.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/core.c (original)
+++ httpd/httpd/branches/2.4.x/server/core.c Tue Aug 14 20:57:43 2012
@@ -996,7 +996,7 @@ AP_DECLARE(const char *) ap_get_server_n
 
 #if APR_HAVE_IPV6
     if (ap_strchr_c(plain_server_name, ':')) { /* IPv6 literal? */
-        return apr_psprintf(r->pool, "[%s]", plain_server_name);
+        return apr_pstrcat(r->pool, "[", plain_server_name, "]", NULL);
     }
 #endif
     return plain_server_name;
@@ -1509,7 +1509,7 @@ static const char *set_error_document(cm
              * a msg and a (local) path.
              */
             conf->response_code_strings[index_number] = (what == MSG) ?
-                    apr_pstrcat(cmd->pool, "\"",msg,NULL) :
+                    apr_pstrcat(cmd->pool, "\"", msg, NULL) :
                     apr_pstrdup(cmd->pool, msg);
         }
     }

Modified: httpd/httpd/branches/2.4.x/server/provider.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/provider.c?rev=1373092&r1=1373091&r2=1373092&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/provider.c (original)
+++ httpd/httpd/branches/2.4.x/server/provider.c Tue Aug 14 20:57:43 2012
@@ -136,7 +136,7 @@ AP_DECLARE(apr_array_header_t *) ap_list
     ap_list_provider_names_t *entry;
     apr_hash_t *provider_group_hash, *h;
     apr_hash_index_t *hi;
-    char *val, *key;
+    char *val;
 
     if (global_providers_names == NULL) {
         return ret;
@@ -157,7 +157,7 @@ AP_DECLARE(apr_array_header_t *) ap_list
     }
 
     for (hi = apr_hash_first(pool, h); hi; hi = apr_hash_next(hi)) {
-        apr_hash_this(hi, (void *)&key, NULL, (void *)&val);
+        apr_hash_this(hi, NULL, NULL, (void *)&val);
         entry = apr_array_push(ret);
         entry->provider_name = apr_pstrdup(pool, val);
     }