It's nice to be able to better inspect the contents of le buffers
This commit is contained in:
parent
82d94fb5ad
commit
bd67f73a1a
2 changed files with 12 additions and 2 deletions
|
@ -1,13 +1,17 @@
|
|||
#ifndef _PATTY_BUFFER_H
|
||||
#define _PATTY_BUFFER_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct _patty_buffer patty_buffer;
|
||||
|
||||
patty_buffer *patty_buffer_new(size_t size);
|
||||
|
||||
void patty_buffer_destroy(patty_buffer *buffer);
|
||||
|
||||
void *patty_buffer_data(patty_buffer *buffer);
|
||||
size_t patty_buffer_size(patty_buffer *buffer);
|
||||
|
||||
void *patty_buffer_data(patty_buffer *buffer, size_t *len);
|
||||
|
||||
ssize_t patty_buffer_fill(patty_buffer *buffer, void *data, size_t len);
|
||||
|
||||
|
|
|
@ -39,7 +39,13 @@ void patty_buffer_destroy(patty_buffer *buffer) {
|
|||
free(buffer);
|
||||
}
|
||||
|
||||
void *patty_buffer_data(patty_buffer *buffer) {
|
||||
size_t patty_buffer_size(patty_buffer *buffer) {
|
||||
return buffer->size;
|
||||
}
|
||||
|
||||
void *patty_buffer_data(patty_buffer *buffer, size_t *len) {
|
||||
*len = buffer->len;
|
||||
|
||||
return buffer->data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue