diff options
| author | Mark Pulford <mark@kyne.com.au> | 2011-05-03 19:47:50 +0930 | 
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2011-05-03 19:47:50 +0930 | 
| commit | 4cfafe0883da22cc020bb4e92d652ce16500b104 (patch) | |
| tree | da23a04ed07085641609f3a9e39aa708da3630a9 /strbuf.h | |
| parent | ec18dfc358cc4391eec3a37bdb81fe8d5a8b3d69 (diff) | |
| download | lua-cjson-4cfafe0883da22cc020bb4e92d652ce16500b104.tar.gz lua-cjson-4cfafe0883da22cc020bb4e92d652ce16500b104.tar.bz2 lua-cjson-4cfafe0883da22cc020bb4e92d652ce16500b104.zip | |
Add strbuf_reset() to reset string length
Add strbuf_reset() to reset string length and hide the string
implementation.
Diffstat (limited to '')
| -rw-r--r-- | strbuf.h | 6 | 
1 files changed, 6 insertions, 0 deletions
| @@ -72,6 +72,12 @@ extern void strbuf_append_number(strbuf_t *s, double number); | |||
| 72 | static void strbuf_append_char(strbuf_t *s, const char c); | 72 | static void strbuf_append_char(strbuf_t *s, const char c); | 
| 73 | static void strbuf_ensure_null(strbuf_t *s); | 73 | static void strbuf_ensure_null(strbuf_t *s); | 
| 74 | 74 | ||
| 75 | /* Reset string for before use */ | ||
| 76 | static inline void strbuf_reset(strbuf_t *s) | ||
| 77 | { | ||
| 78 | s->length = 0; | ||
| 79 | } | ||
| 80 | |||
| 75 | /* Return bytes remaining in the string buffer | 81 | /* Return bytes remaining in the string buffer | 
| 76 | * Ensure there is space for a NULL terminator. */ | 82 | * Ensure there is space for a NULL terminator. */ | 
| 77 | static inline int strbuf_empty_length(strbuf_t *s) | 83 | static inline int strbuf_empty_length(strbuf_t *s) | 
