diff options
author | lijunlong <lijunlong@openresty.com> | 2023-02-22 11:28:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-22 11:28:15 +0800 |
commit | de93a78d3002ee72bb1c7e3a629d67e19623a4ae (patch) | |
tree | fddd9ba083aae1c3f58868e313aa0540885951b8 /strbuf.h | |
parent | 1dff61d9bf390372124c13443e0131a96383f5bc (diff) | |
download | lua-cjson-de93a78d3002ee72bb1c7e3a629d67e19623a4ae.tar.gz lua-cjson-de93a78d3002ee72bb1c7e3a629d67e19623a4ae.tar.bz2 lua-cjson-de93a78d3002ee72bb1c7e3a629d67e19623a4ae.zip |
feature: Add option to skip invalid value types.
Co-authored-by: Jesper Lundgren <jesperlundgren@exosite.com>
Diffstat (limited to '')
-rw-r--r-- | strbuf.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -70,6 +70,7 @@ static char *strbuf_string(strbuf_t *s, int *len); | |||
70 | static void strbuf_ensure_empty_length(strbuf_t *s, int len); | 70 | static void strbuf_ensure_empty_length(strbuf_t *s, int len); |
71 | static char *strbuf_empty_ptr(strbuf_t *s); | 71 | static char *strbuf_empty_ptr(strbuf_t *s); |
72 | static void strbuf_extend_length(strbuf_t *s, int len); | 72 | static void strbuf_extend_length(strbuf_t *s, int len); |
73 | static void strbuf_set_length(strbuf_t *s, int len); | ||
73 | 74 | ||
74 | /* Update */ | 75 | /* Update */ |
75 | extern void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...); | 76 | extern void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...); |
@@ -108,6 +109,11 @@ static inline char *strbuf_empty_ptr(strbuf_t *s) | |||
108 | return s->buf + s->length; | 109 | return s->buf + s->length; |
109 | } | 110 | } |
110 | 111 | ||
112 | static inline void strbuf_set_length(strbuf_t *s, int len) | ||
113 | { | ||
114 | s->length = len; | ||
115 | } | ||
116 | |||
111 | static inline void strbuf_extend_length(strbuf_t *s, int len) | 117 | static inline void strbuf_extend_length(strbuf_t *s, int len) |
112 | { | 118 | { |
113 | s->length += len; | 119 | s->length += len; |