rbb 01/02/28 07:19:41
Modified: . CHANGES
buckets apr_brigade.c
Log:
Initialize the bucket to the amount of data used, not allocated for
buckets created with apr_brigade_*.
Revision Changes Path
1.3 +7 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -b -w -u -r1.2 -r1.3
--- CHANGES 2001/02/28 04:41:13 1.2
+++ CHANGES 2001/02/28 15:19:40 1.3
@@ -1,5 +1,12 @@
Changes with APR-util b1
+ *) We have to initialize the heap buckets to the correct length.
+ we were seeing heap buckets with 17 chars in them reporting
+ a length of 9017, because they were initialized to the amount
+ of memory allocated, instead of the amount of memory used.
+ This was only an issue for heap buckets created by the
+ apr_brigade_* functions. [Ryan Bloom]
+
*) apr_bucket_init_types() and apr_bucket_insert_type() have been
removed... they're not needed anymore. [Cliff Woolley]
1.11 +6 -0 apr-util/buckets/apr_brigade.c
Index: apr_brigade.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -b -w -u -r1.10 -r1.11
--- apr_brigade.c 2001/02/27 20:45:36 1.10
+++ apr_brigade.c 2001/02/28 15:19:41 1.11
@@ -296,6 +296,12 @@
buf = malloc(APR_BUCKET_BUFF_SIZE);
b = apr_bucket_heap_create(buf, APR_BUCKET_BUFF_SIZE, 0, NULL);
APR_BRIGADE_INSERT_TAIL(bb, b);
+ b->length = 0; /* We are writing into the brigade, and
+ * allocating more memory than we need. This
+ * ensures that the bucket thinks it is empty
just
+ * after we create it. We'll fix the length
+ * once we put data in it below.
+ */
}
else {
apr_bucket_heap *h = b->data;