| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
Move all test data into a single data to tidy the main namespace.
|
|
|
|
| |
Rewrite test framework and add descriptions for all tests.
|
|
|
|
|
|
|
| |
Simplify configuration functions by adding an argument position
parameter to json_enum_option() and json_integer_option(). Create
json_arg_init() to check the number of arguments and return the config
data.
|
|
|
|
| |
Also ensure cjson.decode() only receives a single argument.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Increase the default nesting limits to reduce the chance of accidently
throwing an error on valid JSON out of the box.
|
|
|
|
|
|
|
|
|
| |
Update benchmark script to average the best half (round up) of the
result set. Ensure the initial call rate is calculated from a run of at
least 1ms.
Remove garbage collection control since any variations due to garbage
collection are better handled by averaging multiple results.
|
|
|
|
|
| |
Use static strtod() buffer where possible to improve performance 5-10%
under locales with a comma decimal point.
|
|
|
|
|
| |
Deprecate and replace refuse_invalid_numbers() with
encode_invalid_numbers() and decode_invalid_numbers().
|
|
|
|
|
|
|
|
|
|
|
| |
Lua 5.2 is able to extend the Lua stack much further than earlier
versions. Recent testing shows it is possible for Lua CJSON to hit the
process stack limit and segfault. Add a configurable JSON object/array
nesting limit to prevent running out of process stack space.
The current limit is 20 (same as encode).
Add decode_max_depth() configuration function.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Add install-extra make target to install cjson.util module, extra
scripts and tests.
Use "cp" / "chmod" instead of "install" since they are more portable.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Track pointer to the current location in the JSON string, instead of
an index to the string array. Improves decode performance 1-10%.
json_next_token():
- Clean up white space handling and leave "ch" containing the current
non-whitespace character.
|
|
|
|
|
|
| |
- Select via JSON_MODULE environment variable (default "cjson")
- Custom runtime configuration can be stored in bench-MODNAME.lua
- Add run_script() to cjson-misc and update lua2cjson.lua
|
|
|
|
|
| |
- Provide build options for USE_INTERNAL_DTOA and MULTIPLE_THREADS
- Link module with Lua library under Windows
|
|
|
|
|
|
| |
The dtoa.c strtod() function slows down significantly when the number of
digits exceeds the accuracy of a "double". JSON containing excessive
digits is an unrepresentative test, limit to 14 digits.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The internal Lua CJSON dtoa/strtod routines have locale support
disabled. This avoids problems under locales with comma decimal
separators.
Build changes:
- CMake: Check for big endian architectures
- Makefile: Provide option to build with dtoa.c
Modifications to dtoa.c:
- Include locale dtoa_config.h configuration
- Rename Infinity/NaN to inf/nan to match common C libraries
- Rename strtod() -> internal_strtod() to prevent conflict with libc
function
Modifications to g_fmt.c:
- Return output string length (instead of original buffer pointer)
- Provide precision as an argument to g_fmt()
- Silence compilations warnings from vendor source
- while(a = b)
- Unused label "done:"
- Only swap to scientific notation when once the number of decimal
digits required exceeds the precision available. This matches
standard printf format %g.
- Display a "0" in front of numbers < 1.
|
|\ |
|
| |
| |
| |
| | |
See "www.netlib.org/fp/changes" for details.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Windows MinGW doesn't convert Infinity/NaN/hexadecimal numbers. Add
DISABLE_INVALID_NUMBERS build option option to disable invalid numbers.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
- Sanitised arg ordering to encode functions
- Commented json->tmp to explain why decode string processing uses
strbuf_*_unsafe() functions.
|
| |
| |
| |
| |
| |
| |
| | |
Only update the locale when the module is initialised.
cjson.new() can be used if the locale changes part way
through program execution.
|
| |
| |
| |
| |
| |
| | |
When encode_keep_buffer is false, a private buffer will be used.
This will allow multiple encoders to run within a single Lua
state.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Update all Lua scripts to use new module init style everywhere:
local json = require "cjson"
Lua CJSON does not register a global table under Lua 5.2. The global
table can be disabled under Lua 5.1 with DISABLE_CJSON_GLOBAL.
Other changes:
- Store CJSON configuration as an upvalue for each function.
- Add "cjson.new" function to create another module table with a
separate configuration.
- Add _NAME and _VERSION variables.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|