You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/09/10 00:26:33 UTC
cvs commit: apache-2.0/src/modules/experimental mod_charset_lite.c
trawick 00/09/09 15:26:32
Modified: src/modules/experimental mod_charset_lite.c
Log:
Update mod_charset_lite to use the new ring-based macros
for manipulating the brigade.
Revision Changes Path
1.14 +9 -18 apache-2.0/src/modules/experimental/mod_charset_lite.c
Index: mod_charset_lite.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/experimental/mod_charset_lite.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- mod_charset_lite.c 2000/08/30 21:15:33 1.13
+++ mod_charset_lite.c 2000/09/09 22:26:30 1.14
@@ -377,7 +377,7 @@
ap_bucket_brigade *bb;
bb = ap_brigade_create(f->r->pool);
- ap_brigade_append_buckets(bb, ap_bucket_create_transient(tmp, len));
+ AP_BRIGADE_INSERT_TAIL(bb, ap_bucket_create_transient(tmp, len));
return ap_pass_brigade(f->next, bb);
}
@@ -386,21 +386,10 @@
ap_bucket_brigade *bb;
bb = ap_brigade_create(f->r->pool);
- ap_brigade_append_buckets(bb, ap_bucket_create_eos());
+ AP_BRIGADE_INSERT_TAIL(bb, ap_bucket_create_eos());
return ap_pass_brigade(f->next, bb);
}
-static void remove_and_destroy(ap_bucket_brigade *bb, ap_bucket *b)
-{
- if (bb->head == b) {
- bb->head = b->next;
- }
- if (bb->tail == b) {
- bb->tail = b->prev;
- }
- ap_bucket_destroy(b);
-}
-
static apr_status_t set_aside_partial_char(ap_filter_t *f, const char *partial,
apr_ssize_t partial_len)
{
@@ -526,7 +515,7 @@
dc && dc->charset_default ? dc->charset_default : "(none)");
}
- dptr = bb->head;
+ dptr = AP_BRIGADE_FIRST(bb);
done = 0;
cur_len = 0;
space_avail = sizeof(tmp);
@@ -534,13 +523,14 @@
while (!done) {
if (!cur_len) { /* no bytes left to process in the current bucket... */
if (consumed_bucket) {
- remove_and_destroy(bb, consumed_bucket);
+ AP_BUCKET_REMOVE(consumed_bucket);
+ ap_bucket_destroy(consumed_bucket);
consumed_bucket = NULL;
}
- if (!dptr ||
+ if (dptr == AP_BRIGADE_SENTINEL(bb) ||
dptr->read(dptr, &cur_str, &cur_len, 0) == AP_END_OF_BRIGADE) {
done = 1;
- if (dptr && ctx->saved) {
+ if (dptr != AP_BRIGADE_SENTINEL(bb) && ctx->saved) {
/* Oops... we have a partial char from the previous bucket
* that won't be completed because there's no more data.
*/
@@ -550,7 +540,8 @@
break;
}
consumed_bucket = dptr; /* for axing when we're done reading it */
- dptr = dptr->next; /* get ready for when we access the next bucket */
+ dptr = AP_BUCKET_NEXT(dptr); /* get ready for when we access the
+ * next bucket */
}
/* Try to fill up our tmp buffer with translated data. */
cur_avail = cur_len;