MPD 0.17~git
Functions
src/growing_fifo.h File Reference

Helper functions for our FIFO buffer library (fifo_buffer.h) that allows growing the buffer on demand. More...

#include <stddef.h>

Go to the source code of this file.

Functions

struct fifo_buffer * growing_fifo_new (void)
 Allocate a new #fifo_buffer with the default size.
void * growing_fifo_write (struct fifo_buffer **buffer_p, size_t length)
 Prepares writing to the buffer, see fifo_buffer_write() for details.
void growing_fifo_append (struct fifo_buffer **buffer_p, const void *data, size_t length)
 A helper function that combines growing_fifo_write(), memcpy(), fifo_buffer_append().

Detailed Description

Helper functions for our FIFO buffer library (fifo_buffer.h) that allows growing the buffer on demand.

This library is not thread safe.

Definition in file growing_fifo.h.


Function Documentation

void growing_fifo_append ( struct fifo_buffer **  buffer_p,
const void *  data,
size_t  length 
)

A helper function that combines growing_fifo_write(), memcpy(), fifo_buffer_append().

struct fifo_buffer* growing_fifo_new ( void  ) [read]

Allocate a new #fifo_buffer with the default size.

void* growing_fifo_write ( struct fifo_buffer **  buffer_p,
size_t  length 
)

Prepares writing to the buffer, see fifo_buffer_write() for details.

The difference is that this function will automatically grow the buffer if it is too small.

The caller is responsible for limiting the capacity of the buffer.

Parameters:
lengththe number of bytes that will be written
Returns:
a pointer to the end of the buffer (will not be NULL)