jwoolley 01/11/11 19:22:25
Modified: . CHANGES
buckets apr_brigade.c apr_buckets_file.c apr_buckets_heap.c
apr_buckets_pipe.c apr_buckets_simple.c
apr_buckets_socket.c
include apr_buckets.h
Log:
Remove the returned-length "w" parameter from apr_bucket_heap_create()
and apr_bucket_heap_make(). It was useless, since the length is invariant
from the length passed in and from the resulting bucket's b->length. This
takes care of a long-standing issue first brought up in February and
discussed on the [EMAIL PROTECTED] list. (Issue #2 from the "Bucket API
Cleanup
Issues" thread.)
See http://marc.theaimsgroup.com/?l=apr-dev&m=98324983126666&w=2
Reviewed by: Ryan Bloom (concept)
Revision Changes Path
1.37 +7 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -u -r1.36 -r1.37
--- CHANGES 2001/11/07 02:57:21 1.36
+++ CHANGES 2001/11/12 03:22:25 1.37
@@ -1,5 +1,12 @@
Changes with APR-util b1
+ *) Dropped the "w" parameter from apr_bucket_heap_create() and
+ apr_bucket_heap_make(). That parameter was originally intended
+ to return the amount of data copied into the bucket, but it
+ ended up being unnecessary because that amount is invariant from
+ the size of the data and is available as b->length in the
+ resulting bucket anyway. [Cliff Woolley]
+
*) Fix Makefile conversion for BSD/OS. [Cliff Woolley]
*) Use APR_XtOffsetOf instead of offsetof() in the ring macros for
1.26 +2 -2 apr-util/buckets/apr_brigade.c
Index: apr_brigade.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -u -r1.25 -r1.26
--- apr_brigade.c 2001/09/03 22:00:36 1.25
+++ apr_brigade.c 2001/11/12 03:22:25 1.26
@@ -260,7 +260,7 @@
e = apr_bucket_transient_create(*str, *n);
}
else {
- e = apr_bucket_heap_create(*str, *n, 0, NULL);
+ e = apr_bucket_heap_create(*str, *n, 0);
}
APR_BRIGADE_INSERT_TAIL(bb, e);
return 1;
@@ -329,7 +329,7 @@
if (APR_BRIGADE_EMPTY(bb) || !APR_BUCKET_IS_HEAP(b)) {
buf = malloc(APR_BUCKET_BUFF_SIZE);
- b = apr_bucket_heap_create(buf, APR_BUCKET_BUFF_SIZE, 0, NULL);
+ b = apr_bucket_heap_create(buf, APR_BUCKET_BUFF_SIZE, 0);
APR_BRIGADE_INSERT_TAIL(bb, b);
b->length = 0; /* We are writing into the brigade, and
* allocating more memory than we need. This
1.57 +1 -1 apr-util/buckets/apr_buckets_file.c
Index: apr_buckets_file.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -u -r1.56 -r1.57
--- apr_buckets_file.c 2001/09/22 22:36:07 1.56
+++ apr_buckets_file.c 2001/11/12 03:22:25 1.57
@@ -180,7 +180,7 @@
* Change the current bucket to refer to what we read,
* even if we read nothing because we hit EOF.
*/
- apr_bucket_heap_make(e, buf, *len, 0, NULL); /*XXX: check for failure? */
+ apr_bucket_heap_make(e, buf, *len, 0);
/* If we have more to read from the file, then create another bucket */
if (filelength > 0) {
1.39 +5 -8 apr-util/buckets/apr_buckets_heap.c
Index: apr_buckets_heap.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_heap.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -u -r1.38 -r1.39
--- apr_buckets_heap.c 2001/09/22 22:36:07 1.38
+++ apr_buckets_heap.c 2001/11/12 03:22:25 1.39
@@ -78,8 +78,8 @@
}
}
-APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b,
- const char *buf, apr_size_t length, int copy, apr_size_t *w)
+APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char
*buf,
+ apr_size_t length, int copy)
{
apr_bucket_heap *h;
@@ -108,20 +108,17 @@
b = apr_bucket_shared_make(b, h, 0, length);
b->type = &apr_bucket_type_heap;
- if (w)
- *w = length;
-
return b;
}
-APU_DECLARE(apr_bucket *) apr_bucket_heap_create(
- const char *buf, apr_size_t length, int copy, apr_size_t *w)
+APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf,
+ apr_size_t length, int copy)
{
apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
APR_BUCKET_INIT(b);
b->free = free;
- return apr_bucket_heap_make(b, buf, length, copy, w);
+ return apr_bucket_heap_make(b, buf, length, copy);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_heap = {
1.43 +1 -2 apr-util/buckets/apr_buckets_pipe.c
Index: apr_buckets_pipe.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_pipe.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -u -r1.42 -r1.43
--- apr_buckets_pipe.c 2001/09/29 07:06:19 1.42
+++ apr_buckets_pipe.c 2001/11/12 03:22:25 1.43
@@ -97,8 +97,7 @@
if (*len > 0) {
apr_bucket_heap *h;
/* Change the current bucket to refer to what we read */
- /* XXX: check for failure? */
- a = apr_bucket_heap_make(a, buf, *len, 0, NULL);
+ a = apr_bucket_heap_make(a, buf, *len, 0);
h = a->data;
h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
*str = buf;
1.36 +1 -1 apr-util/buckets/apr_buckets_simple.c
Index: apr_buckets_simple.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_simple.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -u -r1.35 -r1.36
--- apr_buckets_simple.c 2001/09/22 22:36:07 1.35
+++ apr_buckets_simple.c 2001/11/12 03:22:25 1.36
@@ -126,7 +126,7 @@
*/
static apr_status_t transient_setaside(apr_bucket *b, apr_pool_t *pool)
{
- b = apr_bucket_heap_make(b, (char *)b->data + b->start, b->length, 1,
NULL);
+ b = apr_bucket_heap_make(b, (char *)b->data + b->start, b->length, 1);
if (b == NULL) {
return APR_ENOMEM;
}
1.34 +1 -2 apr-util/buckets/apr_buckets_socket.c
Index: apr_buckets_socket.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_socket.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -u -r1.33 -r1.34
--- apr_buckets_socket.c 2001/10/10 15:24:03 1.33
+++ apr_buckets_socket.c 2001/11/12 03:22:25 1.34
@@ -100,8 +100,7 @@
if (*len > 0) {
apr_bucket_heap *h;
/* Change the current bucket to refer to what we read */
- /* XXX: check for failure? */
- a = apr_bucket_heap_make(a, buf, *len, 0, NULL);
+ a = apr_bucket_heap_make(a, buf, *len, 0);
h = a->data;
h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
*str = buf;
1.121 +2 -8 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -u -r1.120 -r1.121
--- apr_buckets.h 2001/09/28 03:01:36 1.120
+++ apr_buckets.h 2001/11/12 03:22:25 1.121
@@ -1139,26 +1139,20 @@
* @param buf The buffer to insert into the bucket
* @param nbyte The size of the buffer to insert.
* @param copy Whether to copy the data into newly-allocated memory or not
- * @param w The number of bytes actually copied into the bucket.
- * If copy is zero then this return value can be ignored by passing
a NULL pointer.
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf,
- apr_size_t nbyte, int copy,
- apr_size_t *w);
+ apr_size_t nbyte, int copy);
/**
* Make the bucket passed in a bucket refer to heap data
* @param b The bucket to make into a HEAP bucket
* @param buf The buffer to insert into the bucket
* @param nbyte The size of the buffer to insert.
* @param copy Whether to copy the data into newly-allocated memory or not
- * @param w The number of bytes actually copied into the bucket.
- * If copy is zero then this return value can be ignored by passing
a NULL pointer.
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char
*buf,
- apr_size_t nbyte, int copy,
- apr_size_t *w);
+ apr_size_t nbyte, int copy);
/**
* Create a bucket referring to memory allocated from a pool.