json-c  0.12.1
Data Structures | Macros | Functions
printbuf.h File Reference

Data Structures

struct  printbuf
 

Macros

#define printbuf_memappend_fast(p, bufptr, bufsize)
 
#define printbuf_length(p)   ((p)->bpos)
 

Functions

struct printbufprintbuf_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)
 

Macro Definition Documentation

◆ printbuf_length

#define printbuf_length (   p)    ((p)->bpos)

◆ printbuf_memappend_fast

#define printbuf_memappend_fast (   p,
  bufptr,
  bufsize 
)
Value:
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)
int printbuf_memappend(struct printbuf *p, const char *buf, int size)

Function Documentation

◆ printbuf_free()

void printbuf_free ( struct printbuf p)

◆ printbuf_memappend()

int printbuf_memappend ( struct printbuf p,
const char *  buf,
int  size 
)

◆ printbuf_memset()

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.

◆ printbuf_new()

struct printbuf* printbuf_new ( void  )

◆ printbuf_reset()

void printbuf_reset ( struct printbuf p)

◆ sprintbuf()

int sprintbuf ( struct printbuf p,
const char *  msg,
  ... 
)