33 #ifndef GENLIB_UTIL_MEMBUFFER_H
34 #define GENLIB_UTIL_MEMBUFFER_H
43 #define MINVAL(a, b) ((a) < (b) ? (a) : (b))
44 #define MAXVAL(a, b) ((a) > (b) ? (a) : (b))
68 #define MEMBUF_DEF_SIZE_INC (size_t)5
int memptr_cmp(memptr *m, const char *s)
Compares characters of strings passed for number of bytes. If equal for the number of bytes...
Definition: membuffer.c:66
void membuffer_destroy(membuffer *m)
Free's memory allocated for membuffer* m.
Definition: membuffer.c:165
void membuffer_attach(membuffer *m, char *new_buf, size_t buf_len)
Definition: membuffer.c:292
void membuffer_init(membuffer *m)
Wrapper to membuffer_initialize().
Definition: membuffer.c:157
char * str_alloc(const char *str, size_t str_len)
Allocate memory and copy information from the input string to the newly allocated memory...
Definition: membuffer.c:51
int memptr_cmp_nocase(memptr *m, const char *s)
Compares characters of 2 strings irrespective of the case for a specific count of bytes...
Definition: membuffer.c:81
size_t capacity
Definition: membuffer.h:64
int membuffer_set_size(membuffer *m, size_t new_length)
Increases or decreases buffer cap so that at least 'new_length' bytes can be stored.
Definition: membuffer.c:107
int membuffer_assign_str(membuffer *m, const char *c_str)
Wrapper function for membuffer_assign().
Definition: membuffer.c:200
int membuffer_append_str(membuffer *m, const char *c_str)
Invokes function to appends data from a constant string to the buffer.
Definition: membuffer.c:212
char * buf
Definition: membuffer.h:60
char * buf
Definition: membuffer.h:50
size_t length
Definition: membuffer.h:62
size_t size_inc
Definition: membuffer.h:66
size_t length
Definition: membuffer.h:52
int membuffer_insert(membuffer *m, const void *buf, size_t buf_len, size_t index)
Allocates memory for the new data to be inserted. Does memory management by moving the data from the ...
Definition: membuffer.c:217
char * membuffer_detach(membuffer *m)
Definition: membuffer.c:278
int membuffer_append(membuffer *m, const void *buf, size_t buf_len)
Invokes function to appends data from a constant buffer to the buffer.
Definition: membuffer.c:205
Definition: membuffer.h:57
void membuffer_delete(membuffer *m, size_t index, size_t num_bytes)
Shrink the size of the buffer depending on the current size of the bufer and te input parameters...
Definition: membuffer.c:245
Definition: membuffer.h:47
int membuffer_assign(membuffer *m, const void *buf, size_t buf_len)
Allocate memory to membuffer *m and copy the contents of the in parameter const void *buf...
Definition: membuffer.c:175