apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1402870 - in /apr/apr/trunk: CHANGES buckets/apr_brigade.c
Date Sat, 27 Oct 2012 21:09:45 GMT
Author: sf
Date: Sat Oct 27 21:09:45 2012
New Revision: 1402870

URL: http://svn.apache.org/viewvc?rev=1402870&view=rev
Log:
Remove duplicated logic in apr_brigade_puts().

PR: 53740
Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/buckets/apr_brigade.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1402870&r1=1402869&r2=1402870&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Sat Oct 27 21:09:45 2012
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 2.0.0
 
+  *) Remove duplicated logic in apr_brigade_puts(). PR 53740. [Christophe
+     Jaillet <christophe jaillet wanadoo fr>]
+
   *) apr_password_validate, apr_bcrypt_encode: Add support for bcrypt encoded
      passwords. The bcrypt implementation uses code from crypt_blowfish
      written by Solar Designer <solar openwall com>. apr_bcrypt_encode creates

Modified: apr/apr/trunk/buckets/apr_brigade.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/buckets/apr_brigade.c?rev=1402870&r1=1402869&r2=1402870&view=diff
==============================================================================
--- apr/apr/trunk/buckets/apr_brigade.c (original)
+++ apr/apr/trunk/buckets/apr_brigade.c Sat Oct 27 21:09:45 2012
@@ -617,29 +617,7 @@ APR_DECLARE(apr_status_t) apr_brigade_pu
                                            apr_brigade_flush flush, void *ctx,
                                            const char *str)
 {
-    apr_size_t len = strlen(str);
-    apr_bucket *bkt = APR_BRIGADE_LAST(bb);
-    if (!APR_BRIGADE_EMPTY(bb) && APR_BUCKET_IS_HEAP(bkt)) {
-        /* If there is enough space available in a heap bucket
-         * at the end of the brigade, copy the string directly
-         * into the heap bucket
-         */
-        apr_bucket_heap *h = bkt->data;
-        apr_size_t bytes_avail = h->alloc_len - bkt->length;
-
-        if (bytes_avail >= len) {
-            char *buf = h->base + bkt->start + bkt->length;
-            memcpy(buf, str, len);
-            bkt->length += len;
-            return APR_SUCCESS;
-        }
-    }
-
-    /* If the string could not be copied into an existing heap
-     * bucket, delegate the work to apr_brigade_write(), which
-     * knows how to grow the brigade
-     */
-    return apr_brigade_write(bb, flush, ctx, str, len);
+    return apr_brigade_write(bb, flush, ctx, str, strlen(str));
 }
 
 APR_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b, 



Mime
View raw message