You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/05/21 23:06:16 UTC
svn commit: r1125818 - in /httpd/httpd/trunk/modules: filters/mod_sed.c
generators/mod_cgid.c proxy/proxy_util.c
Author: sf
Date: Sat May 21 21:06:15 2011
New Revision: 1125818
URL: http://svn.apache.org/viewvc?rev=1125818&view=rev
Log:
Replace some "apr_p[c]alloc / memcpy" constructions into a single apr_pmemdup()s
PR: 51214
Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>
Modified:
httpd/httpd/trunk/modules/filters/mod_sed.c
httpd/httpd/trunk/modules/generators/mod_cgid.c
httpd/httpd/trunk/modules/proxy/proxy_util.c
Modified: httpd/httpd/trunk/modules/filters/mod_sed.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_sed.c?rev=1125818&r1=1125817&r2=1125818&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_sed.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_sed.c Sat May 21 21:06:15 2011
@@ -138,8 +138,7 @@ static apr_status_t flush_output_buffer(
apr_status_t status = APR_SUCCESS;
if ((ctx->outbuf == NULL) || (size <=0))
return status;
- out = apr_palloc(ctx->tpool, size);
- memcpy(out, ctx->outbuf, size);
+ out = apr_pmemdup(ctx->tpool, ctx->outbuf, size);
status = append_bucket(ctx, out, size);
ctx->curoutbuf = ctx->outbuf;
return status;
@@ -174,8 +173,7 @@ static apr_status_t sed_write_output(voi
/* if size is bigger than the allocated buffer directly add to output
* brigade */
if ((status == APR_SUCCESS) && (sz >= ctx->bufsize)) {
- char* newbuf = apr_palloc(ctx->tpool, sz);
- memcpy(newbuf, buf, sz);
+ char* newbuf = apr_pmemdup(ctx->tpool, buf, sz);
status = append_bucket(ctx, newbuf, sz);
/* pool might get clear after append_bucket */
if (ctx->outbuf == NULL) {
Modified: httpd/httpd/trunk/modules/generators/mod_cgid.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgid.c?rev=1125818&r1=1125817&r2=1125818&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_cgid.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_cgid.c Sat May 21 21:06:15 2011
@@ -847,8 +847,7 @@ static int cgid_server(void *data)
key = &cgid_req.conn_id;
}
else {
- key = apr_pcalloc(pcgi, sizeof(cgid_req.conn_id));
- memcpy(key, &cgid_req.conn_id, sizeof(cgid_req.conn_id));
+ key = apr_pmemdup(pcgi, &cgid_req.conn_id, sizeof(cgid_req.conn_id));
}
apr_hash_set(script_hash, key, sizeof(cgid_req.conn_id),
(void *)((long)procnew->pid));
Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1125818&r1=1125817&r2=1125818&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Sat May 21 21:06:15 2011
@@ -2618,8 +2618,8 @@ PROXY_DECLARE(int) ap_proxy_connect_back
proxy_function, backend_addr->family, worker->s->hostname);
if (conf->source_address_set) {
- local_addr = apr_pcalloc(conn->pool, sizeof(apr_sockaddr_t));
- memcpy(local_addr, conf->source_address, sizeof(apr_sockaddr_t));
+ local_addr = apr_pmemdup(conn->pool, conf->source_address,
+ sizeof(apr_sockaddr_t));
local_addr->pool = conn->pool;
rv = apr_socket_bind(newsock, local_addr);
if (rv != APR_SUCCESS) {