Rainer Gerhards
c4f8cc34df
more efficient handling for smalls strings inside json_object
...
smalls strings inside json_objects had a high overhead because dynamic
memory allocation was needed for each of them. This also meant that the
pointer needed to be updated. This is now changed so that small strings
can directly be stored inside the json_object. Note that on the regular
64 bit machines a pointer takes 8 bytes. So even without increasing
memory, we could store string up to 7 bytes directly inside the object.
The max size is configurable. I have selected up to 31 bytes (which
means a buffer of 32 including the NUL byte). This brings a 24-bytes
memory overhead, but I consider that still useful because the memory
allocator usually also has quite some overhead (16 bytes) for
dyn alloced memory blocks. In any case, the max buffer size can be
tweaked via #define.
2015-09-23 15:56:48 +02:00
Rainer Gerhards
1ae4b50bde
remove unneeded data items from hashtable code
...
These items were used for statistics tracking, but no code at all
exists to consume them. By removing them we save
a) space
because they counters required space, and did so in each and every
json object
b) performance
because calloc() needs to write less data and the counters are
no longer maintained; cache performance can be better, load
on OS main memory is lighter
We could conditionally enable/disable these counters, but I have not
done this they were really nowhere used and it looked more like a
left-over from the import of hashtable code.
2015-09-23 12:40:57 +02:00
Rainer Gerhards
8f8d03df46
add perllike hash function for strings
...
This also adds a new API json_global_set_string_hash() which permits
to select the hash function. The default one is the only one that was
previously present. So there are no changes to existing apps, and the
new hash function needs to be explicitely be opted in. Especially for
smaller strings, the perllike functions seems to be around twice as
fast as the other one, with similarly good results in value distribution.
2015-09-23 12:23:09 +02:00
Rainer Gerhards
2d549662be
add json_object_object_add_ex() API
...
This provides more control over some detail aspects, many
of which are performance related.
2015-09-23 09:43:00 +02:00
Rainer Gerhards
d8e44dc685
reduce duplicate hash computation in json_object_object_add()
...
This can be a very considerable performance saver.
2015-09-22 19:07:30 +02:00
Eric Haszlakiewicz
ec4879ac5b
Merge pull request #153 from LeSpocky/doc
...
improve doc for json_object_to_json_string()
2014-09-13 22:18:51 -04:00
Eric Haszlakiewicz
6ec6fdaf8c
Merge pull request #151 from mjchinn/json_type-comma
...
Remove json_type enum trailing comma
2014-09-13 22:18:14 -04:00
Eric Haszlakiewicz
2c722277ee
Merge pull request #150 from ams-cs/master
...
Fix build using MinGW.
2014-09-13 22:17:57 -04:00
Eric Haszlakiewicz
f88db708ac
Merge pull request #141 from AlexandruCostache/master
...
Removed duplicate check in random_seed test - bug #140
2014-09-13 22:14:44 -04:00
Alexander Dahl
37f5d8696d
improve doc for json_object_to_json_string()
2014-08-18 10:28:38 +02:00
Michael J. Chinn
048dcf288a
Remove json_type enum trailing comma
2014-08-10 00:46:25 -04:00
Andrew Stubbs
ca0ebe0f71
Fix build using MinGW.
...
MinGW requires wincrypt.h.
GCC does not support #pragma comment, which trips Werror.
2014-08-04 11:44:25 +01:00
Alexandru Costache
4841c48f81
Removed duplicate check in random_seed test - bug #140
2014-07-04 12:28:35 +03:00
Eric Haszlakiewicz
d4e81f9ec8
Move the json_min() and json_max() macros to json_util.h and mark everything else in bits.h deprecated.
...
Eliminate all uses of bits.h within the json-c code.
2014-05-04 22:33:26 -04:00
Eric Haszlakiewicz
1da0599e0e
Fix the definition of the error_description() macro in bits.h now that json_tokener_errors[] is not exported.
2014-05-03 22:26:26 -04:00
Eric Haszlakiewicz
2149a04ca8
Check for failures when allocating memory; return NULL and set errno=ENOMEM in a few of those cases.
...
Thanks to Susant Sahani for pointing out some of these.
2014-04-19 20:33:05 -04:00
Eric Haszlakiewicz
92a7740e90
Reformat some code in json_object.c
2014-04-19 20:23:54 -04:00
Eric Haszlakiewicz
795e9151a1
Add an empty README file to placate autoconf.
2014-04-19 20:22:44 -04:00
Eric Haszlakiewicz
4569e3e430
Fix minor typo in README file.
2014-04-19 20:11:05 -04:00
Eric Haszlakiewicz
40aab4c502
Merge pull request #133 from haneefmubarak/patch-1
...
Update and rename README to README.md
2014-04-19 20:10:10 -04:00
Eric Haszlakiewicz
332a594fd4
Merge pull request #132 from pkoretic/master
...
Remove unused variable 'size'
2014-04-19 20:05:06 -04:00
Haneef Mubarak
7870978c2e
Update README.md
...
- code blocks
- slight text changes (rewording)
- pretty printing
2014-04-12 00:40:05 -07:00
Haneef Mubarak
23620b827c
Update and rename README to README.md
...
Markdownify + fix a few errors here and there
2014-04-12 00:36:08 -07:00
Eric Haszlakiewicz
fa54bd542e
Update the release checklist to include calculating the tarball checksums and updating the wiki.
2014-04-11 20:07:49 -04:00
Petar Koretić
259c5c0b5f
Remove unused variable 'size'
2014-04-11 10:03:40 +02:00
Eric Haszlakiewicz
515ba0dfb7
Bump versions up to 0.12.99 since a 0.12 release was just created.
2014-04-10 22:44:13 -04:00
Eric Haszlakiewicz
f84d9c55db
Update the ChangeLog with the changes for the 0.12 release.
...
Bump the version in the release checklist.
2014-04-10 21:07:20 -04:00
Michael Clark
64e36901a0
Patch to address the following issues:
...
* CVE-2013-6371: hash collision denial of service
* CVE-2013-6370: buffer overflow if size_t is larger than int
2014-04-09 13:48:21 +08:00
Eric Haszlakiewicz
784534a31f
Eliminate the deprecated mc_abort() function and MC_ABORT macro.
2014-03-22 21:48:34 -04:00
Eric Haszlakiewicz
f9136f6852
Make the json_tokener_errors array local. It has been deprecated for a while, and json_tokener_error_desc() should be used instead.
2014-03-22 21:41:24 -04:00
Eric Haszlakiewicz
936d036ea3
Simplify the tests Makefile to avoid repeating the name of each test.
2014-03-22 21:40:37 -04:00
Eric Haszlakiewicz
e2bbb5664c
Rename the "test_case" test to "test_charcase" to make it slightly less confusing.
2014-03-22 21:15:41 -04:00
Eric Haszlakiewicz
9f26d96f09
Fix warnings from autoconf about "...no AC_LANG_SOURCE call detected..." by adding that call within the AC_LINK_IFELSE call.
2014-03-22 19:15:01 -04:00
Eric Haszlakiewicz
05da316b9c
Issue #103 : allow Infinity and -Infinity to be parsed.
2014-03-22 17:28:40 -04:00
Eric Haszlakiewicz
217bc29352
Merge pull request #123 from fingon/use-NAN-if-available
...
nan function requires -lm on some platforms - use of NAN is better, if available
2014-03-22 13:39:36 -04:00
Markus Stenberg
a1c8991e13
nan function requires -lm on some platforms; use of NAN is better, if available.
2014-03-18 16:29:49 +02:00
Eric Haszlakiewicz
0eedf3802f
Issue#102 - add support for parsing "NaN".
2014-03-09 16:41:33 -04:00
Eric Haszlakiewicz
e6f1322b5e
Issue#114: check for the presence of isnan and isinf, and provide compat macros on MSCV where _isnan and _finite exist instead.
2014-03-02 12:16:37 -05:00
Eric Haszlakiewicz
db117ca02b
Merge pull request #121 from TazeTSchnitzel/LowercaseLiterals
...
Missing lowercase literals test
2014-02-12 13:37:17 -05:00
Andrea Faulds
cf23e7506e
Merge branch 'master' into LowercaseLiterals
2014-02-12 09:52:25 +00:00
Andrea Faulds
1d6f9140ba
Missing tests
2014-02-12 09:51:51 +00:00
Eric Haszlakiewicz
4c086dfff7
Merge commit '89535bb'
2014-02-11 23:57:24 -05:00
Eric Haszlakiewicz
020fa65724
Merge pull request #112 from TazeTSchnitzel/LowercaseLiterals
...
Only allow lowercase literals in STRICT mode
2014-02-11 23:21:50 -05:00
Eric Haszlakiewicz
56df93d128
Fix Issue #111 : Fix off-by-one error when range checking the input to json_tokener_error_desc().
2014-02-11 23:16:53 -05:00
Eric Haszlakiewicz
ceeaf42bc8
Merge pull request #109 from kdopen/use_strtod
...
Avoid potential overflow in json_object_get_double
2014-02-11 23:13:19 -05:00
Eric Haszlakiewicz
b821f0e10f
Merge branch 'ebassi-master'
2014-02-11 23:06:19 -05:00
Eric Haszlakiewicz
c8e0497d47
Merge branch 'master' of https://github.com/ebassi/json-c into ebassi-master
...
Conflicts:
Makefile.am
2014-02-11 23:05:54 -05:00
Eric Haszlakiewicz
295bea21d0
Ignore and cleanup a few more files that automake creates.
2014-02-11 23:03:46 -05:00
Eric Haszlakiewicz
a2c078fc6e
Issue#105: Rename configure.in to configure.ac
2014-02-11 22:55:52 -05:00
Eric Haszlakiewicz
c8ee919642
Remove the old libjson.so name compatibility support. The library is only created as libjson-c.so now and headers are only installed into the ${prefix}/json-c directory.
2014-02-11 22:49:59 -05:00