void chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) { chunk *c; if (buffer_string_is_empty(mem)) return; c = chunkqueue_get_unused_chunk(cq); c->type = MEM_CHUNK; force_assert(NULL != c->mem); buffer_move(c->mem, mem); chunkqueue_prepend_chunk(cq, c); }
buffer * chunkqueue_get_prepend_buffer(chunkqueue *cq) { chunk *c; c = chunkqueue_get_unused_chunk(cq); c->type = MEM_CHUNK; c->offset = 0; buffer_reset(c->mem); chunkqueue_prepend_chunk(cq, c); return c->mem; }
int chunkqueue_prepend_buffer(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; buffer_copy_string_buffer(c->mem, mem); chunkqueue_prepend_chunk(cq, c); return 0; }