MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
printbuf.h File Reference

Go to the source code of this file.

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)
 

Data Structure Documentation

struct printbuf

Definition at line 23 of file printbuf.h.

Data Fields
char * buf
int bpos
int size

Macro Definition Documentation

#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)
Definition: printbuf.c:79

Definition at line 42 of file printbuf.h.

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

Definition at line 51 of file printbuf.h.

Function Documentation

struct printbuf* printbuf_new ( void  )

Definition at line 34 of file printbuf.c.

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

Definition at line 79 of file printbuf.c.

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.

Definition at line 91 of file printbuf.c.

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

Definition at line 152 of file printbuf.c.

void printbuf_reset ( struct printbuf p)

Definition at line 180 of file printbuf.c.

void printbuf_free ( struct printbuf p)

Definition at line 186 of file printbuf.c.