Functions | |
int | u_buf_reserve (u_buf_t *ubuf, size_t size) |
Enlarge the underlying memory block of the given buffer. | |
int | u_buf_append (u_buf_t *ubuf, const void *data, size_t size) |
Append some data to the buffer. | |
int | u_buf_load (u_buf_t *ubuf, const char *filename) |
Fill a buffer object with the content of a file. | |
int | u_buf_detach (u_buf_t *ubuf) |
Release buffer's underlying memory block without freeing it. | |
size_t | u_buf_size (u_buf_t *ubuf) |
Return the size of memory block allocated by the buffer. | |
size_t | u_buf_len (u_buf_t *ubuf) |
Return the length of the buffer. | |
int | u_buf_clear (u_buf_t *ubuf) |
Clear a buffer. | |
int | u_buf_set (u_buf_t *ubuf, const void *data, size_t size) |
Set the value of a buffer. | |
void * | u_buf_ptr (u_buf_t *ubuf) |
Return a pointer to the buffer internal momory block. | |
int | u_buf_free (u_buf_t *ubuf) |
Free a buffer. | |
int | u_buf_printf (u_buf_t *ubuf, const char *fmt,...) |
Append a string to the given buffer. | |
int | u_buf_create (u_buf_t **pubuf) |
Create a new buffer. |
|
Append data of size size to the given buffer. If needed the buffer will be enlarged.
Definition at line 68 of file buf.c. References u_buf_reserve(). Referenced by u_buf_set(). |
|
Totally erase the content of the given buffer. The memory allocated by the buffer will not be released until u_buf_free() is called.
Definition at line 204 of file buf.c. Referenced by u_buf_load(), and u_buf_set(). |
|
Create a new buffer object and save its pointer to *ps.
Definition at line 348 of file buf.c. References u_zalloc(). |
|
Release the underlying memory block of the given buffer without calling free() on it. The caller must free the buffer later on (probably after using it somwhow). Use u_buf_ptr() to get the pointer of the memory block, u_buf_size() to get its size and u_buf_len() to get its length.
|
|
Release all resources and free the given buffer object.
Definition at line 269 of file buf.c. References u_free(). |
|
Return the length of data store in the given buffer.
|
|
Open filename and copy its whole content into the given buffer.
Definition at line 100 of file buf.c. References u_buf_clear(), and u_buf_reserve(). |
|
Create a string from the printf-style arguments and append it to the given u_buf_t object. The length of the appended string (NOT including the ending '\0') will be added to the current length of the buffer (u_buf_len).
Definition at line 298 of file buf.c. References u_buf_reserve(). |
|
Return a void* pointer to the memory block allocated by the buffer object.
|
|
Enlarge the buffer data block to (at least) size bytes.
Definition at line 31 of file buf.c. References u_realloc(). Referenced by u_buf_append(), u_buf_load(), and u_buf_printf(). |
|
Set the value of ubuf to data. If needed the buffer object will alloc more memory to store the data value.
Definition at line 227 of file buf.c. References u_buf_append(), and u_buf_clear(). |
|
Return the size of memory block allocated by the buffer.
|