brianp 2002/09/29 18:57:56
Modified: buckets apr_brigade.c
Log:
In apr_brigade_writev(), create heap buckets instead of
transient buckets if there is no flush function. (Thanks
to Greg Stein for catching this.)
Revision Changes Path
1.54 +13 -6 apr-util/buckets/apr_brigade.c
Index: apr_brigade.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- apr_brigade.c 29 Sep 2002 01:05:37 -0000 1.53
+++ apr_brigade.c 30 Sep 2002 01:57:55 -0000 1.54
@@ -470,19 +470,26 @@
total_len += vec[i].iov_len;
}
- /* If the data to be written is very large, convert
+ /* If the data to be written is very large, try to convert
* the iovec to transient buckets rather than copying.
*/
if (total_len > APR_BUCKET_BUFF_SIZE) {
- for (i = 0; i < nvec; i++) {
- e = apr_bucket_transient_create(vec[i].iov_base, vec[i].iov_len,
- b->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(b, e);
- }
if (flush) {
+ for (i = 0; i < nvec; i++) {
+ e = apr_bucket_transient_create(vec[i].iov_base,
+ vec[i].iov_len,
+ b->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(b, e);
+ }
return flush(b, ctx);
}
else {
+ for (i = 0; i < nvec; i++) {
+ e = apr_bucket_heap_create((const char *) vec[i].iov_base,
+ vec[i].iov_len, NULL,
+ b->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(b, e);
+ }
return APR_SUCCESS;
}
}