commit
1bd3f56693
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
#include "fpconv.h"
|
#include "fpconv.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Lua CJSON assumes the locale is the same for all threads within a
|
/* Lua CJSON assumes the locale is the same for all threads within a
|
||||||
* process and doesn't change after initialisation.
|
* process and doesn't change after initialisation.
|
||||||
*
|
*
|
||||||
|
@ -203,6 +204,6 @@ void fpconv_init()
|
||||||
{
|
{
|
||||||
fpconv_update_locale();
|
fpconv_update_locale();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* vi:ai et sw=4 ts=4:
|
/* vi:ai et sw=4 ts=4:
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,13 +45,10 @@
|
||||||
#include "flash_api.h"
|
#include "flash_api.h"
|
||||||
|
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#ifdef LUA_NUMBER_INTEGRAL
|
|
||||||
#include "fpconv.h"
|
|
||||||
#else
|
|
||||||
#define FPCONV_G_FMT_BUFSIZE 32
|
#define FPCONV_G_FMT_BUFSIZE 32
|
||||||
#define fpconv_strtod c_strtod
|
#define fpconv_strtod c_strtod
|
||||||
#define fpconv_init() ((void)0)
|
#define fpconv_init() ((void)0)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CJSON_MODNAME
|
#ifndef CJSON_MODNAME
|
||||||
#define CJSON_MODNAME "cjson"
|
#define CJSON_MODNAME "cjson"
|
||||||
|
@ -774,12 +771,10 @@ static void json_append_number(lua_State *l, json_config_t *cfg,
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_ensure_empty_length(json, FPCONV_G_FMT_BUFSIZE);
|
strbuf_ensure_empty_length(json, FPCONV_G_FMT_BUFSIZE);
|
||||||
#ifdef LUA_NUMBER_INTEGRAL
|
// len = fpconv_g_fmt(strbuf_empty_ptr(json), num, cfg->encode_number_precision);
|
||||||
len = fpconv_g_fmt(strbuf_empty_ptr(json), num, cfg->encode_number_precision);
|
c_sprintf(strbuf_empty_ptr(json), LUA_NUMBER_FMT, (LUA_NUMBER)num);
|
||||||
#else
|
|
||||||
c_sprintf(strbuf_empty_ptr(json), "%.14g", num);
|
|
||||||
len = c_strlen(strbuf_empty_ptr(json));
|
len = c_strlen(strbuf_empty_ptr(json));
|
||||||
#endif
|
|
||||||
strbuf_extend_length(json, len);
|
strbuf_extend_length(json, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue