httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From taka...@apache.org
Subject svn commit: r726884 - in /httpd/httpd/trunk: server/util.c support/ab.c
Date Tue, 16 Dec 2008 00:08:01 GMT
Author: takashi
Date: Mon Dec 15 16:08:01 2008
New Revision: 726884

URL: http://svn.apache.org/viewvc?rev=726884&view=rev
Log:
* Change some "apr_palloc / memcpy" to apr_pstrmemdup

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

* Remove unnecessary casts

Modified:
    httpd/httpd/trunk/server/util.c
    httpd/httpd/trunk/support/ab.c

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=726884&r1=726883&r2=726884&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Mon Dec 15 16:08:01 2008
@@ -578,9 +578,8 @@
         return apr_pstrdup(p, "");
     }
     l = (last_slash - s) + 1;
-    d = apr_palloc(p, l + 1);
-    memcpy(d, s, l);
-    d[l] = 0;
+    d = apr_pstrmemdup(p, s, l);
+
     return (d);
 }
 
@@ -611,9 +610,7 @@
     }
 
     len = pos - *line;
-    res = (char *)apr_palloc(atrans, len + 1);
-    memcpy(res, *line, len);
-    res[len] = 0;
+    res = apr_pstrmemdup(atrans, *line, len);
 
     if (stop) {
         while (*pos == stop) {
@@ -641,9 +638,7 @@
     }
 
     len = pos - *line;
-    res = (char *)apr_palloc(atrans, len + 1);
-    memcpy(res, *line, len);
-    res[len] = 0;
+    res = apr_pstrmemdup(atrans, *line, len);
 
     while (apr_isspace(*pos)) {
         ++pos;

Modified: httpd/httpd/trunk/support/ab.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/ab.c?rev=726884&r1=726883&r2=726884&view=diff
==============================================================================
--- httpd/httpd/trunk/support/ab.c (original)
+++ httpd/httpd/trunk/support/ab.c Mon Dec 15 16:08:01 2008
@@ -1892,9 +1892,7 @@
 
     if ((cp = strchr(url, '/')) == NULL)
         return 1;
-    h = apr_palloc(cntxt, cp - url + 1);
-    memcpy(h, url, cp - url);
-    h[cp - url] = '\0';
+    h = apr_pstrmemdup(cntxt, url, cp - url);
     rv = apr_parse_addr_port(&hostname, &scope_id, &port, h, cntxt);
     if (rv != APR_SUCCESS || !hostname || scope_id) {
         return 1;



Mime
View raw message