return n;
}
-static void chunk_shift(struct buf_chunk *chunk)
-{
- if(chunk->r_offset) {
- if(!chunk_is_empty(chunk)) {
- size_t n = chunk->w_offset - chunk->r_offset;
- memmove(chunk->x.data, chunk->x.data + chunk->r_offset, n);
- chunk->w_offset -= chunk->r_offset;
- chunk->r_offset = 0;
- }
- else {
- chunk->r_offset = chunk->w_offset = 0;
- }
- }
-}
-
static void chunk_list_free(struct buf_chunk **anchor)
{
struct buf_chunk *chunk;
}
}
-void Curl_bufq_skip_and_shift(struct bufq *q, size_t amount)
-{
- Curl_bufq_skip(q, amount);
- if(q->tail)
- chunk_shift(q->tail);
-}
-
ssize_t Curl_bufq_pass(struct bufq *q, Curl_bufq_writer *writer,
void *writer_ctx, CURLcode *err)
{
*/
void Curl_bufq_skip(struct bufq *q, size_t amount);
-/**
- * Same as `skip` but shift tail data to the start afterwards,
- * so that further writes will find room in tail.
- */
-void Curl_bufq_skip_and_shift(struct bufq *q, size_t amount);
-
typedef ssize_t Curl_bufq_writer(void *writer_ctx,
const unsigned char *buf, size_t len,
CURLcode *err);