You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2002/01/23 19:46:36 UTC
cvs commit: apr-util/buckets apr_brigade.c
jerenkrantz 02/01/23 10:46:36
Modified: include apr_buckets.h
buckets apr_brigade.c
Log:
Fix up apr_brigade_pflatten to make more sense.
- Return apr_status_t so errors don't get lost.
- Stop the NULL-termination.
Revision Changes Path
1.125 +7 -4 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- apr_buckets.h 23 Jan 2002 18:39:21 -0000 1.124
+++ apr_buckets.h 23 Jan 2002 18:46:36 -0000 1.125
@@ -700,13 +700,16 @@
apr_off_t *len);
/**
- * Returns a pool-allocated string representing a flat bucket brigade
+ * Creates a pool-allocated string representing a flat bucket brigade
* @param bb The bucket brigade to create the iovec from
+ * @param c On return, the allocated char array
+ * @param len On return, the length of the char array.
* @param p The pool to allocate the string from.
- * Note: This string is NULL-terminated.
*/
-APU_DECLARE(char *) apr_brigade_pflatten(apr_bucket_brigade *bb,
- apr_pool_t *pool);
+APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb,
+ char **c,
+ apr_off_t *len,
+ apr_pool_t *pool);
/**
* Split a brigade to represent one LF line.
1.30 +14 -9 apr-util/buckets/apr_brigade.c
Index: apr_brigade.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- apr_brigade.c 23 Jan 2002 18:39:21 -0000 1.29
+++ apr_brigade.c 23 Jan 2002 18:46:36 -0000 1.30
@@ -256,20 +256,25 @@
return APR_SUCCESS;
}
-APU_DECLARE(char *) apr_brigade_pflatten(apr_bucket_brigade *bb,
- apr_pool_t *pool)
+APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb,
+ char **c,
+ apr_off_t *len,
+ apr_pool_t *pool)
{
- apr_off_t tmp, actual;
- char *c;
+ apr_off_t total;
+ apr_status_t rv;
- apr_brigade_length(bb, 1, &tmp);
- actual = tmp;
+ apr_brigade_length(bb, 1, &total);
- c = apr_palloc(pool, actual + 1);
+ *c = apr_palloc(pool, total);
- apr_brigade_flatten(bb, c, &actual);
- c[actual] = '\0';
+ rv = apr_brigade_flatten(bb, *c, &total);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+
+ *len = total;
return APR_SUCCESS;
}