Browse Source

added append_buffer_weak() which take the buffer directly instead of copying it

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.11-ssl-fixes@1324 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.12
Jan Kneschke 16 years ago
parent
commit
8517995f52
  1. 17
      src/chunk.c
  2. 1
      src/chunk.h

17
src/chunk.c

@ -194,6 +194,22 @@ int chunkqueue_append_buffer(chunkqueue *cq, buffer *mem) {
return 0;
}
int chunkqueue_append_buffer_weak(chunkqueue *cq, buffer *mem) {
chunk *c;
if (mem->used == 0) return 0;
c = chunkqueue_get_unused_chunk(cq);
c->type = MEM_CHUNK;
c->offset = 0;
if (c->mem) buffer_free(c->mem);
c->mem = mem;
chunkqueue_append_chunk(cq, c);
return 0;
}
int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) {
chunk *c;
@ -209,6 +225,7 @@ int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) {
return 0;
}
int chunkqueue_append_mem(chunkqueue *cq, const char * mem, size_t len) {
chunk *c;

1
src/chunk.h

@ -51,6 +51,7 @@ int chunkqueue_set_tempdirs(chunkqueue *c, array *tempdirs);
int chunkqueue_append_file(chunkqueue *c, buffer *fn, off_t offset, off_t len);
int chunkqueue_append_mem(chunkqueue *c, const char *mem, size_t len);
int chunkqueue_append_buffer(chunkqueue *c, buffer *mem);
int chunkqueue_append_buffer_weak(chunkqueue *c, buffer *mem);
int chunkqueue_prepend_buffer(chunkqueue *c, buffer *mem);
buffer * chunkqueue_get_append_buffer(chunkqueue *c);

Loading…
Cancel
Save