jwoolley 01/04/11 12:07:11
Modified: server error_bucket.c
. CHANGES
buckets apr_buckets_eos.c apr_buckets_file.c
apr_buckets_flush.c apr_buckets_heap.c
apr_buckets_mmap.c apr_buckets_pipe.c
apr_buckets_pool.c apr_buckets_simple.c
apr_buckets_socket.c
include apr_buckets.h
Log:
Removed apr_bucket_do_create() macro, which was causing warnings
about unreachable code in some compilers (notably MSVC). What
used to be done by this macro is now done inline in the various
apr_bucket_foo_create() functions. [Cliff Woolley]
Revision Changes Path
1.3 +4 -1 httpd-2.0/server/error_bucket.c
Index: error_bucket.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/error_bucket.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -u -r1.2 -r1.3
--- error_bucket.c 2001/02/27 21:02:15 1.2
+++ error_bucket.c 2001/04/11 19:07:01 1.3
@@ -90,7 +90,10 @@
AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error,
const char *buf, apr_pool_t *p)
{
- apr_bucket_do_create(ap_bucket_error_make(b, error, buf, p));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return ap_bucket_error_make(b, error, buf, p);
}
AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error = {
1.11 +5 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -u -r1.10 -r1.11
--- CHANGES 2001/04/11 06:42:22 1.10
+++ CHANGES 2001/04/11 19:07:02 1.11
@@ -1,5 +1,10 @@
Changes with APR-util b1
+ *) Removed apr_bucket_do_create() macro, which was causing warnings
+ about unreachable code in some compilers (notably MSVC). What
+ used to be done by this macro is now done inline in the various
+ apr_bucket_foo_create() functions. [Cliff Woolley]
+
*) Make clean, distclean, and extraclean consistently according to the
Gnu makefile guidelines. [Justin Erenkrantz <jerenkrantz@ebuilt.com>]
1.23 +4 -1 apr-util/buckets/apr_buckets_eos.c
Index: apr_buckets_eos.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_eos.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -u -r1.22 -r1.23
--- apr_buckets_eos.c 2001/02/27 20:45:36 1.22
+++ apr_buckets_eos.c 2001/04/11 19:07:03 1.23
@@ -81,7 +81,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_eos_create(void)
{
- apr_bucket_do_create(apr_bucket_eos_make(b));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_eos_make(b);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_eos = {
1.40 +4 -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.39
retrieving revision 1.40
diff -u -d -u -r1.39 -r1.40
--- apr_buckets_file.c 2001/03/01 04:59:06 1.39
+++ apr_buckets_file.c 2001/04/11 19:07:04 1.40
@@ -192,7 +192,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_file_create(apr_file_t *fd,
apr_off_t offset, apr_size_t len)
{
- apr_bucket_do_create(apr_bucket_file_make(b, fd, offset, len));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_file_make(b, fd, offset, len);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_file = {
1.15 +4 -1 apr-util/buckets/apr_buckets_flush.c
Index: apr_buckets_flush.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_flush.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -u -r1.14 -r1.15
--- apr_buckets_flush.c 2001/02/27 20:45:36 1.14
+++ apr_buckets_flush.c 2001/04/11 19:07:04 1.15
@@ -81,7 +81,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_flush_create(void)
{
- apr_bucket_do_create(apr_bucket_flush_make(b));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_flush_make(b);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_flush = {
1.31 +4 -1 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.30
retrieving revision 1.31
diff -u -d -u -r1.30 -r1.31
--- apr_buckets_heap.c 2001/03/01 04:59:07 1.30
+++ apr_buckets_heap.c 2001/04/11 19:07:04 1.31
@@ -117,7 +117,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_heap_create(
const char *buf, apr_size_t length, int copy, apr_size_t *w)
{
- apr_bucket_do_create(apr_bucket_heap_make(b, buf, length, copy, w));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_heap_make(b, buf, length, copy, w);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_heap = {
1.34 +4 -1 apr-util/buckets/apr_buckets_mmap.c
Index: apr_buckets_mmap.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_mmap.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -u -r1.33 -r1.34
--- apr_buckets_mmap.c 2001/03/01 04:59:07 1.33
+++ apr_buckets_mmap.c 2001/04/11 19:07:05 1.34
@@ -108,7 +108,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(
apr_mmap_t *mm, apr_off_t start, apr_size_t length)
{
- apr_bucket_do_create(apr_bucket_mmap_make(b, mm, start, length));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_mmap_make(b, mm, start, length);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_mmap = {
1.34 +4 -1 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.33
retrieving revision 1.34
diff -u -d -u -r1.33 -r1.34
--- apr_buckets_pipe.c 2001/02/28 17:19:00 1.33
+++ apr_buckets_pipe.c 2001/04/11 19:07:05 1.34
@@ -144,7 +144,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *p)
{
- apr_bucket_do_create(apr_bucket_pipe_make(b, p));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_pipe_make(b, p);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_pipe = {
1.16 +4 -1 apr-util/buckets/apr_buckets_pool.c
Index: apr_buckets_pool.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_pool.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -u -r1.15 -r1.16
--- apr_buckets_pool.c 2001/03/01 04:46:13 1.15
+++ apr_buckets_pool.c 2001/04/11 19:07:06 1.16
@@ -156,7 +156,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_pool_create(
const char *buf, apr_size_t length, apr_pool_t *pool)
{
- apr_bucket_do_create(apr_bucket_pool_make(b, buf, length, pool));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_pool_make(b, buf, length, pool);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_pool = {
1.26 +8 -2 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.25
retrieving revision 1.26
diff -u -d -u -r1.25 -r1.26
--- apr_buckets_simple.c 2001/02/28 23:46:53 1.25
+++ apr_buckets_simple.c 2001/04/11 19:07:06 1.26
@@ -112,7 +112,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(
const char *buf, apr_size_t length)
{
- apr_bucket_do_create(apr_bucket_immortal_make(b, buf, length));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_immortal_make(b, buf, length);
}
/*
@@ -146,7 +149,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_transient_create(
const char *buf, apr_size_t length)
{
- apr_bucket_do_create(apr_bucket_transient_make(b, buf, length));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_transient_make(b, buf, length);
}
const apr_bucket_type_t apr_bucket_type_immortal = {
1.23 +4 -1 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.22
retrieving revision 1.23
diff -u -d -u -r1.22 -r1.23
--- apr_buckets_socket.c 2001/02/28 17:19:01 1.22
+++ apr_buckets_socket.c 2001/04/11 19:07:06 1.23
@@ -139,7 +139,10 @@
APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *p)
{
- apr_bucket_do_create(apr_bucket_socket_make(b, p));
+ apr_bucket *b = (apr_bucket *)calloc(1, sizeof(*b));
+
+ APR_BUCKET_INIT(b);
+ return apr_bucket_socket_make(b, p);
}
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_socket = {
1.94 +7 -19 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -u -r1.93 -r1.94
--- apr_buckets.h 2001/04/10 19:32:29 1.93
+++ apr_buckets.h 2001/04/11 19:07:10 1.94
@@ -402,6 +402,13 @@
#define APR_BUCKET_REMOVE(e) APR_RING_REMOVE((e), link)
/**
+ * Initialize a new bucket's prev/next pointers
+ * @param e The bucket to initialize
+ * @deffunc void APR_BUCKET_INIT(apr_bucket *e)
+ */
+#define APR_BUCKET_INIT(e) APR_RING_ELEM_INIT((e), link);
+
+/**
* Determine if a bucket is a FLUSH bucket
* @param e The bucket to inspect
* @return true or false
@@ -1013,25 +1020,6 @@
* other code should call apr_bucket_create_foo. All the initialization
* functions change nothing if they fail.
*/
-
-/*
- * This macro implements the guts of apr_bucket_create_foo
- */
-#define apr_bucket_do_create(do_make) \
- do { \
- apr_bucket *b, *ap__b; \
- b = calloc(1, sizeof(*b)); \
- if (b == NULL) { \
- return NULL; \
- } \
- ap__b = do_make; \
- if (ap__b == NULL) { \
- free(b); \
- return NULL; \
- } \
- APR_RING_ELEM_INIT(ap__b, link); \
- return ap__b; \
- } while(0)
/**
* Create an End of Stream bucket. This indicates that there is no more data
|