Data Structures | |
struct | printbuf |
Defines | |
#define | printbuf_memappend_fast(p, bufptr, bufsize) |
#define | printbuf_length(p) ((p)->bpos) |
Functions | |
struct printbuf * | printbuf_new (void) |
int | printbuf_memappend (struct printbuf *p, const char *buf, int size) |
int | printbuf_memset (struct printbuf *pb, int offset, int charvalue, int len) |
int | sprintbuf (struct printbuf *p, const char *msg,...) |
void | printbuf_reset (struct printbuf *p) |
void | printbuf_free (struct printbuf *p) |
#define printbuf_length | ( | p | ) | ((p)->bpos) |
#define printbuf_memappend_fast | ( | p, | |||
bufptr, | |||||
bufsize | ) |
do { \ if ((p->size - p->bpos) > bufsize) { \ memcpy(p->buf + p->bpos, (bufptr), bufsize); \ p->bpos += bufsize; \ p->buf[p->bpos]= '\0'; \ } else { printbuf_memappend(p, (bufptr), bufsize); } \ } while (0)
void printbuf_free | ( | struct printbuf * | p | ) |
int printbuf_memappend | ( | struct printbuf * | p, | |
const char * | buf, | |||
int | size | |||
) |
int printbuf_memset | ( | struct printbuf * | pb, | |
int | offset, | |||
int | charvalue, | |||
int | len | |||
) |
Set len bytes of the buffer to charvalue, starting at offset offset. Similar to calling memset(x, charvalue, len);
The memory allocated for the buffer is extended as necessary.
If offset is -1, this starts at the end of the current data in the buffer.
struct printbuf* printbuf_new | ( | void | ) | [read] |
void printbuf_reset | ( | struct printbuf * | p | ) |
int sprintbuf | ( | struct printbuf * | p, | |
const char * | msg, | |||
... | ||||
) |