Browse Source

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 17 years ago
parent
commit
6481f003f2
  1. 15
      src/buffer.c
  2. 1
      src/buffer.h

15
src/buffer.c

@ -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);

1
src/buffer.h

@ -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);

Loading…
Cancel
Save