aboutsummaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-12-30 14:17:44 +1030
committerMark Pulford <mark@kyne.com.au>2011-12-30 14:17:44 +1030
commit2416b145073211b840781da6abf4b6d97f4657a6 (patch)
tree6e92a13a7cc8ef8357245bc3ef320f5841350991 /strbuf.h
parent6cc88e3ac5275868e168acaf60203563f131355b (diff)
downloadlua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.tar.gz
lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.tar.bz2
lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.zip
Add fpconv to work around comma decimal points
Create a separate buffer and translate comma <> dot before calling strtod(), and after calling sprintf() as required. - Add "update_locale" Lua API call and init locale on module load. - Move sprintf format string to fpconv
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/strbuf.h b/strbuf.h
index f856543..fbc8651 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -62,7 +62,9 @@ extern void strbuf_resize(strbuf_t *s, int len);
62static int strbuf_empty_length(strbuf_t *s); 62static int strbuf_empty_length(strbuf_t *s);
63static int strbuf_length(strbuf_t *s); 63static int strbuf_length(strbuf_t *s);
64static char *strbuf_string(strbuf_t *s, int *len); 64static char *strbuf_string(strbuf_t *s, int *len);
65static void strbuf_ensure_empty_length(strbuf_t *s, int len); 65static void strbuf_ensure_empty_length(strbuf_t *s, int len);
66static char *strbuf_empty_ptr(strbuf_t *s);
67static void strbuf_extend_length(strbuf_t *s, int len);
66 68
67/* Update */ 69/* Update */
68extern void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...); 70extern void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...);
@@ -96,6 +98,16 @@ static inline void strbuf_ensure_empty_length(strbuf_t *s, int len)
96 strbuf_resize(s, s->length + len); 98 strbuf_resize(s, s->length + len);
97} 99}
98 100
101static inline char *strbuf_empty_ptr(strbuf_t *s)
102{
103 return s->buf + s->length;
104}
105
106static inline void strbuf_extend_length(strbuf_t *s, int len)
107{
108 s->length += len;
109}
110
99static inline int strbuf_length(strbuf_t *s) 111static inline int strbuf_length(strbuf_t *s)
100{ 112{
101 return s->length; 113 return s->length;