You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@locus.apache.org on 2000/12/09 22:22:44 UTC
cvs commit: apr-util/src/buckets Makefile.in ap_buckets.c ap_buckets_util.c
rbb 00/12/09 13:22:44
Modified: include ap_buckets.h
src/buckets Makefile.in ap_buckets.c
Removed: src/buckets ap_buckets_util.c
Log:
Remove ap_bucket_copy_any, and move ap_bucket_split_any into ap_buckets.c.
This allows us to remove ap_buckets_util.c.
Revision Changes Path
1.59 +1 -14 apr-util/include/ap_buckets.h
Index: ap_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/ap_buckets.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- ap_buckets.h 2000/12/08 16:10:29 1.58
+++ ap_buckets.h 2000/12/09 21:22:43 1.59
@@ -182,7 +182,7 @@
* start/end/offset information. If it's not possible to do this
* for the bucket type (perhaps the length of the data is indeterminate,
* as with pipe and socket buckets), then APR_ENOTIMPL is returned.
- * See also ap_bucket_split_any().
+ * @see ap_bucket_split_any().
* @param e The bucket to split
* @param point The offset of the first byte in the new bucket
* @deffunc apr_status_t split(ap_bucket *e, apr_off_t point)
@@ -192,7 +192,6 @@
/**
* Copy the bucket structure (not the data), assuming that this is
* possible for the bucket type. If it's not, APR_ENOTIMPL is returned.
- * See also ap_bucket_copy_any().
* @param e The bucket to copy
* @param c Returns a pointer to the new bucket
* @deffunc apr_status_t copy
@@ -717,18 +716,6 @@
* @deffunc apr_status_t ap_bucket_split_any(ap_bucket *e, apr_off_t point)
*/
APR_DECLARE(apr_status_t) ap_bucket_split_any(ap_bucket *e, apr_off_t point);
-
-/**
- * Copy a bucket, using ap_bucket_copy() if that's possible for the given
- * bucket type. If copy() is not implemented for the bucket's type, then
- * we copy the data as well by performing a blocking read on the bucket.
- * That morphs the bucket into a copyable one, which we then copy.
- * @param e The bucket to copy
- * @param c Returns a pointer to the new bucket
- * @deffunc apr_status_t ap_bucket_copy_any(ap_bucket *e, ap_bucket **c)
- */
-APR_DECLARE(apr_status_t) ap_bucket_copy_any(ap_bucket *e, ap_bucket **c);
-
/* Bucket type handling */
1.5 +1 -1 apr-util/src/buckets/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apr-util/src/buckets/Makefile.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.in 2000/12/08 11:02:32 1.4
+++ Makefile.in 2000/12/09 21:22:44 1.5
@@ -2,7 +2,7 @@
TARGETS = ap_buckets_file.lo ap_buckets_pool.lo ap_buckets_flush.lo \
ap_buckets_refcount.lo ap_buckets_heap.lo ap_buckets_simple.lo ap_buckets.lo \
ap_buckets_mmap.lo ap_buckets_socket.lo ap_buckets_eos.lo ap_buckets_pipe.lo \
-ap_buckets_util.lo ap_buckets.lo
+ap_buckets.lo
top_builddir = @top_builddir@
include $(top_builddir)/build/rules.mk
1.36 +27 -0 apr-util/src/buckets/ap_buckets.c
Index: ap_buckets.c
===================================================================
RCS file: /home/cvs/apr-util/src/buckets/ap_buckets.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- ap_buckets.c 2000/12/08 11:02:33 1.35
+++ ap_buckets.c 2000/12/09 21:22:44 1.36
@@ -122,6 +122,33 @@
return a;
}
+APR_DECLARE(apr_status_t) ap_bucket_split_any(ap_bucket *e, apr_off_t point)
+{
+ apr_status_t rv;
+ const char *str;
+ apr_size_t len;
+
+ /* try to split this bucket directly */
+ rv = ap_bucket_split(e, point);
+ if (rv != APR_ENOTIMPL) {
+ return rv;
+ }
+
+ /* if the bucket cannot be split, we must read from it,
+ * changing its type to one that can be split */
+ if (point < 0) {
+ return APR_EINVAL;
+ }
+ rv = ap_bucket_read(e, &str, &len, AP_BLOCK_READ);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ if (point > len) {
+ return APR_EINVAL;
+ }
+ return ap_bucket_split(e, point);
+}
+
APR_DECLARE(int) ap_brigade_to_iovec(ap_bucket_brigade *b,
struct iovec *vec, int nvec)
{