summaryrefslogtreecommitdiff
path: root/buckets
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2012-10-27 21:09:45 +0000
committerStefan Fritsch <sf@apache.org>2012-10-27 21:09:45 +0000
commit84671572b4954da80e51b3da3a35ffed11e26516 (patch)
tree644b78ac3cff52165b7b391b7fb42627ed56999d /buckets
parent4b9430801f1cefc08c0d252ea384509aec877a50 (diff)
downloadapr-84671572b4954da80e51b3da3a35ffed11e26516.tar.gz
Remove duplicated logic in apr_brigade_puts().
PR: 53740 Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1402870 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets')
-rw-r--r--buckets/apr_brigade.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/buckets/apr_brigade.c b/buckets/apr_brigade.c
index 02319214f..a0fcd8781 100644
--- a/buckets/apr_brigade.c
+++ b/buckets/apr_brigade.c
@@ -617,29 +617,7 @@ APR_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
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,