dgaudet 99/06/20 12:34:29
Modified: mpm/src/include ap_buf.h mpm/src/ap ap_buf.c Log: some other stuff left over from hacking zero-copy Revision Changes Path 1.2 +4 -0 apache-2.0/mpm/src/include/ap_buf.h Index: ap_buf.h =================================================================== RCS file: /home/cvs/apache-2.0/mpm/src/include/ap_buf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ap_buf.h 1999/06/19 20:42:01 1.1 +++ ap_buf.h 1999/06/20 19:34:28 1.2 @@ -73,6 +73,7 @@ struct ap_buf { ap_bufel *head; ap_bufel **tail; + unsigned size; }; /* allocate a bufel */ @@ -93,5 +94,8 @@ /* create an iovec of the elements in buf... return number of elements used */ API_EXPORT(int) ap_buf_to_iovec(ap_buf *, struct iovec *vec, int nvec); + +/* catenate buf b onto buf a, buf b is empty after this */ +API_EXPORT(void) ap_buf_catenate(ap_buf *a, ap_buf *b); #endif 1.2 +15 -0 apache-2.0/mpm/src/ap/ap_buf.c Index: ap_buf.c =================================================================== RCS file: /home/cvs/apache-2.0/mpm/src/ap/ap_buf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ap_buf.c 1999/06/19 20:42:00 1.1 +++ ap_buf.c 1999/06/20 19:34:29 1.2 @@ -76,12 +76,14 @@ { b->head = NULL; b->tail = &b->head; + b->size = 0; } API_EXPORT(void) ap_buf_append(ap_buf *b, ap_bufel *e) { e->next = *b->tail; b->tail = &e->next; + b->size += e->end - e->start; } API_EXPORT(void) ap_buf_consume(ap_buf *b, int nbytes) @@ -90,6 +92,7 @@ ap_bufel *n; int amt; + b->size -= nbytes; e = b->head; while (e && nbytes) { amt = e->end - e->start; @@ -123,4 +126,16 @@ ++vec; } return vec - orig; +} + +API_EXPORT(void) ap_buf_catenate(ap_buf *a, ap_buf *b) +{ + if (b->head) { + *a->tail = b->head; + a->tail = b->tail; + b->head = NULL; + b->tail = &b->head; + a->size += b->size; + b->size = 0; + } }