19 #if !(defined(__GNUC__) || defined(__clang__)) && !defined(__attribute__)
20 #define __attribute__(x)
91 #define buffer_vprintf buffer_putvfstring
101 __attribute__ (( format(printf,2,3) )) ;
102 #define buffer_printf buffer_putfstring
117 #define buffer_putstring(b,s) (buffer_putlstring(b,s,strlen(s)))
124 #define buffer_putliteral(b,l) (buffer_putlstring(b,l "",sizeof(l)-1))
int buffer_putvfstring(buffer_t *b, const char *format, va_list ap)
Print the formatted output to the buffer.
int buffer_putfstring(buffer_t *b, const char *format,...) __attribute__((format(printf
Appends the formatted output to the buffer.
void buffer_rewind(buffer_t *b, size_t n)
Rewinds the buffer to position n.
const char * buffer_tostring(buffer_t *b, size_t *size)
Returns the buffer as a string.
void buffer_max(buffer_t *b, size_t max)
Set the maximum size of the buffer.
void buffer_init(buffer_t *b)
Initialize a buffer.
int buffer_putlstring(buffer_t *b, const char *str, size_t len)
Appends the string to the end of the buffer.
void buffer_free(buffer_t *b)
Free any resources and memory in use by a buffer.
void buffer_abortonfailure(buffer_t *b, int abortonfailure)
Set the buffer to call fatal(...) on error instead of returning an error code.
size_t buffer_pos(buffer_t *b)
Get the current position in the buffer.
void buffer_ubuf(buffer_t *b, char *buf, size_t len)
Use the provided buffer as a starting buffer.