diff options
| author | Mark Pulford <mark@kyne.com.au> | 2011-05-10 22:32:01 +0930 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2011-05-10 22:32:01 +0930 |
| commit | 126470cc7b6c2314c02805e4d00afe04b6b00312 (patch) | |
| tree | 9dd59bcc02307403410ef405b0f02bf39bd57560 /strbuf.c | |
| parent | c877da6c1f84b19cd2e7e8154b4a0d0e355745a0 (diff) | |
| download | lua-cjson-126470cc7b6c2314c02805e4d00afe04b6b00312.tar.gz lua-cjson-126470cc7b6c2314c02805e4d00afe04b6b00312.tar.bz2 lua-cjson-126470cc7b6c2314c02805e4d00afe04b6b00312.zip | |
Add runtime option for persistent encode buffer
Diffstat (limited to '')
| -rw-r--r-- | strbuf.c | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -99,12 +99,16 @@ static inline void debug_stats(strbuf_t *s) | |||
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | /* If strbuf_t has not been dynamically allocated, strbuf_free() can | ||
| 103 | * be called any number of times strbuf_init() */ | ||
| 102 | void strbuf_free(strbuf_t *s) | 104 | void strbuf_free(strbuf_t *s) |
| 103 | { | 105 | { |
| 104 | debug_stats(s); | 106 | debug_stats(s); |
| 105 | 107 | ||
| 106 | if (s->buf) | 108 | if (s->buf) { |
| 107 | free(s->buf); | 109 | free(s->buf); |
| 110 | s->buf = NULL; | ||
| 111 | } | ||
| 108 | if (s->dynamic) | 112 | if (s->dynamic) |
| 109 | free(s); | 113 | free(s); |
| 110 | } | 114 | } |
