Buffer Utility Functions.
More...
#include <glib.h>
Go to the source code of this file.
Buffer Utility Functions.
Definition in file circbuffer.h.
◆ purple_circ_buffer_append()
void purple_circ_buffer_append |
( |
PurpleCircBuffer * |
buf, |
|
|
gconstpointer |
src, |
|
|
gsize |
len |
|
) |
| |
Append data to the PurpleCircBuffer.
This will grow the internal buffer to fit the added data, if needed.
- Parameters
-
buf | The PurpleCircBuffer to which to append the data |
src | pointer to the data to copy into the buffer |
len | number of bytes to copy into the buffer |
◆ purple_circ_buffer_destroy()
Dispose of the PurpleCircBuffer and free any memory used by it (including any memory used by the internal buffer).
- Parameters
-
buf | The PurpleCircBuffer to free |
◆ purple_circ_buffer_get_max_read()
Determine the maximum number of contiguous bytes that can be read from the PurpleCircBuffer.
Note: This may not be the total number of bytes that are buffered - a subsequent call after calling purple_circ_buffer_mark_read() may indicate more data is available to read.
- Parameters
-
buf | the PurpleCircBuffer for which to determine the maximum contiguous bytes that can be read. |
- Returns
- the number of bytes that can be read from the PurpleCircBuffer
◆ purple_circ_buffer_mark_read()
Mark the number of bytes that have been read from the buffer.
- Parameters
-
buf | The PurpleCircBuffer to mark bytes read from |
len | The number of bytes to mark as read |
- Returns
- TRUE if we successfully marked the bytes as having been read, FALSE otherwise.
◆ purple_circ_buffer_new()
Creates a new circular buffer.
This will not allocate any memory for the actual buffer until data is appended to it.
- Parameters
-
growsize | The amount that the buffer should grow the first time data is appended and every time more space is needed. Pass in "0" to use the default of 256 bytes. |
- Returns
- The new PurpleCircBuffer. This should be freed with purple_circ_buffer_destroy when you are done with it