summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2011-04-06 13:04:12 +0000
committerJeff Trawick <trawick@apache.org>2011-04-06 13:04:12 +0000
commit892373af8586cbead091981141193c1d79bb70d4 (patch)
treed1b77e3cea5baebc871b454b043e5b2f37eb99a5
parent507e014a790fc1e7a30ff608597b4874391fc876 (diff)
downloadapr-892373af8586cbead091981141193c1d79bb70d4.tar.gz
change apr_palloc+memcpy to apr_pmemdup
PR: 47776 Submitted by: Boya Sun <boya.sun case.edu> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1089438 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--file_io/os2/filedup.c3
-rw-r--r--file_io/unix/filedup.c3
-rw-r--r--file_io/win32/filedup.c3
-rw-r--r--strings/apr_strings.c3
-rw-r--r--xlate/xlate.c4
5 files changed, 6 insertions, 10 deletions
diff --git a/file_io/os2/filedup.c b/file_io/os2/filedup.c
index 810e227fb..ff937eb68 100644
--- a/file_io/os2/filedup.c
+++ b/file_io/os2/filedup.c
@@ -87,8 +87,7 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
apr_file_t *old_file,
apr_pool_t *p)
{
- *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t));
- memcpy(*new_file, old_file, sizeof(apr_file_t));
+ *new_file = (apr_file_t *)apr_pmemdup(p, old_file, sizeof(apr_file_t));
(*new_file)->pool = p;
if (old_file->buffered) {
diff --git a/file_io/unix/filedup.c b/file_io/unix/filedup.c
index ab31e9443..797f8045f 100644
--- a/file_io/unix/filedup.c
+++ b/file_io/unix/filedup.c
@@ -152,8 +152,7 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
apr_file_t *old_file,
apr_pool_t *p)
{
- *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t));
- memcpy(*new_file, old_file, sizeof(apr_file_t));
+ *new_file = (apr_file_t *)apr_pmemdup(p, old_file, sizeof(apr_file_t));
(*new_file)->pool = p;
if (old_file->buffered) {
(*new_file)->buffer = apr_palloc(p, old_file->bufsize);
diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c
index e1dfc1649..058e0e6cb 100644
--- a/file_io/win32/filedup.c
+++ b/file_io/win32/filedup.c
@@ -187,8 +187,7 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
apr_file_t *old_file,
apr_pool_t *p)
{
- *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t));
- memcpy(*new_file, old_file, sizeof(apr_file_t));
+ *new_file = (apr_file_t *)apr_pmemdup(p, old_file, sizeof(apr_file_t));
(*new_file)->pool = p;
if (old_file->buffered) {
(*new_file)->buffer = apr_palloc(p, old_file->bufsize);
diff --git a/strings/apr_strings.c b/strings/apr_strings.c
index d20004ead..0ba49c844 100644
--- a/strings/apr_strings.c
+++ b/strings/apr_strings.c
@@ -75,8 +75,7 @@ APR_DECLARE(char *) apr_pstrdup(apr_pool_t *a, const char *s)
return NULL;
}
len = strlen(s) + 1;
- res = apr_palloc(a, len);
- memcpy(res, s, len);
+ res = apr_pmemdup(a, s, len);
return res;
}
diff --git a/xlate/xlate.c b/xlate/xlate.c
index 400949f1c..ab1c5f508 100644
--- a/xlate/xlate.c
+++ b/xlate/xlate.c
@@ -117,8 +117,8 @@ static void check_sbcs(apr_xlate_t *convset)
* close the iconv descriptor
*/
- convset->sbcs_table = apr_palloc(convset->pool, sizeof(outbuf));
- memcpy(convset->sbcs_table, outbuf, sizeof(outbuf));
+ convset->sbcs_table = apr_pmemdup(convset->pool, outbuf, sizeof(outbuf));
+
iconv_close(convset->ich);
convset->ich = (iconv_t)-1;