added a reset function to buffer_array

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@425 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.3.15
Jan Kneschke 2005-07-07 09:18:05 +00:00
parent ee98c09aba
commit 6481f003f2
2 changed files with 16 additions and 0 deletions

View File

@ -414,6 +414,20 @@ buffer_array* buffer_array_init(void) {
return b;
}
void buffer_array_reset(buffer_array *b) {
size_t i;
if (!b) return;
/* if they are too large, reduce them */
for (i = 0; i < b->used; i++) {
buffer_reset(b->ptr[i]);
}
b->used = 0;
}
/**
* free the buffer_array
*
@ -432,6 +446,7 @@ void buffer_array_free(buffer_array *b) {
buffer *buffer_array_append_get_buffer(buffer_array *b) {
size_t i;
if (b->size == 0) {
b->size = 16;
b->ptr = malloc(sizeof(*b->ptr) * b->size);

View File

@ -35,6 +35,7 @@ typedef struct {
buffer_array* buffer_array_init(void);
void buffer_array_free(buffer_array *b);
void buffer_array_reset(buffer_array *b);
buffer *buffer_array_append_get_buffer(buffer_array *b);
buffer* buffer_init(void);