You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rp...@apache.org on 2012/10/29 11:21:40 UTC

svn commit: r1403235 - in /apr/apr-util/branches/1.4.x: ./ CHANGES buckets/apr_brigade.c

Author: rpluem
Date: Mon Oct 29 10:21:38 2012
New Revision: 1403235

URL: http://svn.apache.org/viewvc?rev=1403235&view=rev
Log:
Merge r1402870 from trunk:

Remove duplicated logic in apr_brigade_puts().

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

Reviewed by: rpluem

Modified:
    apr/apr-util/branches/1.4.x/   (props changed)
    apr/apr-util/branches/1.4.x/CHANGES
    apr/apr-util/branches/1.4.x/buckets/apr_brigade.c

Propchange: apr/apr-util/branches/1.4.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1402870

Modified: apr/apr-util/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/CHANGES?rev=1403235&r1=1403234&r2=1403235&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.4.x/CHANGES [utf-8] Mon Oct 29 10:21:38 2012
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.4.3
 
+  *) Remove duplicated logic in apr_brigade_puts(). PR 53740. [Christophe
+     Jaillet <christophe jaillet wanadoo fr>]
+
   *) memcache: Fix dead server retry logic.  [Gavin Shelley <columbusmonkey me.com>]
 
   *) Improve platform detection for bundled expat by updating

Modified: apr/apr-util/branches/1.4.x/buckets/apr_brigade.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/buckets/apr_brigade.c?rev=1403235&r1=1403234&r2=1403235&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/buckets/apr_brigade.c (original)
+++ apr/apr-util/branches/1.4.x/buckets/apr_brigade.c Mon Oct 29 10:21:38 2012
@@ -591,29 +591,7 @@ APU_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));
 }
 
 APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b,