diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2012-04-02 15:39:55 -0500 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2012-04-02 15:39:55 -0500 |
commit | 2d48543f2ef8caadcbdbd9b3b779664038bf6a2b (patch) | |
tree | afe71c9e3126edb49313edfe1ea3d699d2f67a48 /printbuf.h | |
parent | 781798ccdfbe56abd5046d3978e29adf10c74c23 (diff) | |
download | json-c-2d48543f2ef8caadcbdbd9b3b779664038bf6a2b.tar.gz |
Add a printbuf_memset() function to provide an effecient way to set and append things like whitespace indentation.
Diffstat (limited to 'printbuf.h')
-rw-r--r-- | printbuf.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -50,6 +50,19 @@ do { \ } else { printbuf_memappend(p, (bufptr), bufsize); } \ } while (0) +#define printbuf_length(p) ((p)->bpos) + +/** + * 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. + */ +extern int +printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len); + extern int sprintbuf(struct printbuf *p, const char *msg, ...); |