Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA7F76B57 for ; Wed, 22 Jun 2011 20:45:56 +0000 (UTC) Received: (qmail 40237 invoked by uid 500); 22 Jun 2011 20:45:56 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 40120 invoked by uid 500); 22 Jun 2011 20:45:56 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 40113 invoked by uid 99); 22 Jun 2011 20:45:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2011 20:45:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2011 20:45:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DF5DB2388906; Wed, 22 Jun 2011 20:45:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1138627 - in /httpd/httpd/trunk: modules/aaa/ modules/cluster/ modules/dav/fs/ modules/dav/main/ modules/mappers/ modules/proxy/ server/ Date: Wed, 22 Jun 2011 20:45:34 -0000 To: cvs@httpd.apache.org From: sf@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110622204534.DF5DB2388906@eris.apache.org> Author: sf Date: Wed Jun 22 20:45:34 2011 New Revision: 1138627 URL: http://svn.apache.org/viewvc?rev=1138627&view=rev Log: Various code cleanup PR: 51398 Submitted by: Christophe Jaillet Modified: httpd/httpd/trunk/modules/aaa/mod_authnz_ldap.c httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c httpd/httpd/trunk/modules/dav/fs/repos.c httpd/httpd/trunk/modules/dav/main/mod_dav.c httpd/httpd/trunk/modules/mappers/mod_rewrite.c httpd/httpd/trunk/modules/proxy/mod_serf.c httpd/httpd/trunk/modules/proxy/proxy_util.c httpd/httpd/trunk/server/util.c httpd/httpd/trunk/server/vhost.c Modified: httpd/httpd/trunk/modules/aaa/mod_authnz_ldap.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_authnz_ldap.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/aaa/mod_authnz_ldap.c (original) +++ httpd/httpd/trunk/modules/aaa/mod_authnz_ldap.c Wed Jun 22 20:45:34 2011 @@ -1378,8 +1378,8 @@ static const char *mod_auth_ldap_parse_u * Get rid of the surrounding parens; later on when generating the * filter, they'll be put back. */ - sec->filter = apr_pstrdup(cmd->pool, urld->lud_filter+1); - sec->filter[strlen(sec->filter)-1] = '\0'; + sec->filter = apr_pstrmemdup(cmd->pool, urld->lud_filter+1, + strlen(urld->lud_filter)-2); } else { sec->filter = apr_pstrdup(cmd->pool, urld->lud_filter); Modified: httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (original) +++ httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c Wed Jun 22 20:45:34 2011 @@ -770,7 +770,7 @@ static int hm_handler(request_rec *r) ap_set_content_type(r, "text/plain"); ap_set_content_length(r, 2); - ap_rprintf(r, "OK"); + ap_rputs("OK", r); ap_rflush(r); return OK; Modified: httpd/httpd/trunk/modules/dav/fs/repos.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/repos.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/dav/fs/repos.c (original) +++ httpd/httpd/trunk/modules/dav/fs/repos.c Wed Jun 22 20:45:34 2011 @@ -719,8 +719,7 @@ static dav_error * dav_fs_get_resource( /* make sure the URI does not have a trailing "/" */ len = strlen(r->uri); if (len > 1 && r->uri[len - 1] == '/') { - s = apr_pstrdup(r->pool, r->uri); - s[len - 1] = '\0'; + s = apr_pstrmemdup(r->pool, r->uri, len-1); resource->uri = s; } else { Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original) +++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Wed Jun 22 20:45:34 2011 @@ -160,8 +160,8 @@ static void *dav_create_dir_config(apr_p char *d; apr_size_t l; - d = apr_pstrdup(p, dir); - l = strlen(d); + l = strlen(dir); + d = apr_pstrmemdup(p, dir, l); if (l > 1 && d[l - 1] == '/') d[l - 1] = '\0'; conf->dir = d; Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original) +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Wed Jun 22 20:45:34 2011 @@ -1759,7 +1759,7 @@ static char *lookup_variable(char *var, /* fast exit */ if (varlen < 4) { - return apr_pstrdup(r->pool, ""); + return ""; } result = NULL; @@ -2211,7 +2211,7 @@ static char *do_expand(char *input, rewr /* fast exit */ if (inputlen == span) { - return apr_pstrdup(pool, input); + return apr_pstrmemdup(pool, input, inputlen); } /* well, actually something to do */ Modified: httpd/httpd/trunk/modules/proxy/mod_serf.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_serf.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/mod_serf.c (original) +++ httpd/httpd/trunk/modules/proxy/mod_serf.c Wed Jun 22 20:45:34 2011 @@ -634,8 +634,7 @@ static int serf_handler(request_rec *r) static int is_true(const char *w) { - if (strcasecmp(w, "on") == 0 || - strcasecmp(w, "1") == 0 || + if (strcasecmp(w, "on") == 0 || strcmp(w, "1") == 0 || strcasecmp(w, "true") == 0) { return 1; @@ -678,8 +677,7 @@ static const char *add_pass(cmd_parms *c const char *x = ap_strchr_c(p, '='); if (x) { - char *key = apr_pstrndup(cmd->pool, p, x-p); - if (strcmp(key, "preservehost") == 0) { + if (strncmp(p, "preservehost", x-p) == 0) { conf->preservehost = is_true(x+1); } } Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original) +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Wed Jun 22 20:45:34 2011 @@ -1682,8 +1682,8 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_g return NULL; } - url_copy = apr_pstrdup(p, url); url_length = strlen(url); + url_copy = apr_pstrmemdup(p, url, url_length); /* * We need to find the start of the path and Modified: httpd/httpd/trunk/server/util.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/server/util.c (original) +++ httpd/httpd/trunk/server/util.c Wed Jun 22 20:45:34 2011 @@ -670,8 +670,9 @@ AP_DECLARE(char *) ap_getword_nulls(apr_ char *res; if (!pos) { - res = apr_pstrdup(atrans, *line); - *line += strlen(*line); + size_t len = strlen(*line); + res = apr_pstrmemdup(atrans, *line, len); + *line += len; return res; } Modified: httpd/httpd/trunk/server/vhost.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/vhost.c?rev=1138627&r1=1138626&r2=1138627&view=diff ============================================================================== --- httpd/httpd/trunk/server/vhost.c (original) +++ httpd/httpd/trunk/server/vhost.c Wed Jun 22 20:45:34 2011 @@ -158,9 +158,9 @@ static const char *get_addresses(apr_poo if (*w_ == '\0') return NULL; - w = apr_pstrdup(p, w_); + wlen = strlen(w_); /* wlen must be > 0 at this point */ + w = apr_pstrmemdup(p, w_, wlen); /* apr_parse_addr_port() doesn't understand ":*" so handle that first. */ - wlen = strlen(w); /* wlen must be > 0 at this point */ wild_port = 0; if (w[wlen - 1] == '*') { if (wlen < 2) {