satyr
0.24.15.g3735.dirty
|
A string buffer structure and related algorithms. More...
Go to the source code of this file.
Data Structures | |
struct | sr_strbuf |
A resizable string buffer. More... | |
Functions | |
struct sr_strbuf * | sr_strbuf_new (void) |
void | sr_strbuf_init (struct sr_strbuf *strbuf) |
void | sr_strbuf_free (struct sr_strbuf *strbuf) |
char * | sr_strbuf_free_nobuf (struct sr_strbuf *strbuf) |
void | sr_strbuf_clear (struct sr_strbuf *strbuf) |
void | sr_strbuf_grow (struct sr_strbuf *strbuf, size_t num) |
struct sr_strbuf * | sr_strbuf_append_char (struct sr_strbuf *strbuf, char c) |
struct sr_strbuf * | sr_strbuf_append_str (struct sr_strbuf *strbuf, const char *str) |
struct sr_strbuf * | sr_strbuf_prepend_str (struct sr_strbuf *strbuf, const char *str) |
struct sr_strbuf * | sr_strbuf_append_strf (struct sr_strbuf *strbuf, const char *format,...) __sr_printf(2 |
struct sr_strbuf struct sr_strbuf * | sr_strbuf_append_strfv (struct sr_strbuf *strbuf, const char *format, va_list p) |
struct sr_strbuf * | sr_strbuf_prepend_strf (struct sr_strbuf *strbuf, const char *format,...) __sr_printf(2 |
struct sr_strbuf struct sr_strbuf * | sr_strbuf_prepend_strfv (struct sr_strbuf *strbuf, const char *format, va_list p) |
A string buffer structure and related algorithms.
Definition in file strbuf.h.
The current content of the string buffer is extended by adding a character c at its end.
The current content of the string buffer is extended by adding a string str at its end.
The current content of the string buffer is extended by adding a sequence of data formatted as the format argument specifies.
struct sr_strbuf struct sr_strbuf* sr_strbuf_append_strfv | ( | struct sr_strbuf * | strbuf, |
const char * | format, | ||
va_list | p | ||
) |
Same as sr_strbuf_append_strf except that va_list is used instead of variable number of arguments.
void sr_strbuf_clear | ( | struct sr_strbuf * | strbuf | ) |
The string content is set to an empty string, erasing any previous content and leaving its length at 0 characters.
void sr_strbuf_free | ( | struct sr_strbuf * | strbuf | ) |
Releases the memory held by the string buffer.
strbuf | If the strbuf is NULL, no operation is performed. |
char* sr_strbuf_free_nobuf | ( | struct sr_strbuf * | strbuf | ) |
Releases the strbuf, but not the internal buffer. The internal string buffer is returned. Caller is responsible to release the returned memory using free().
void sr_strbuf_grow | ( | struct sr_strbuf * | strbuf, |
size_t | num | ||
) |
Ensures that the buffer can be extended by num characters without dealing with malloc/realloc.
void sr_strbuf_init | ( | struct sr_strbuf * | strbuf | ) |
Initializes all members of the strbuf structure to their default values. No memory is released, members are simply overritten. This is useful for initializing a strbuf structure placed on the stack.
struct sr_strbuf* sr_strbuf_new | ( | void | ) |
Creates and initializes a new string buffer.
The current content of the string buffer is extended by inserting a string str at its beginning.
The current content of the string buffer is extended by inserting a sequence of data formatted as the format argument specifies at the buffer beginning.