Commit Graph

407 Commits

Author SHA1 Message Date
Eric Haszlakiewicz
82bdbdba24 Merge pull request #219 from rouault/low_heap_robustness_fixes
Fix various potential null ptr deref and int32 overflows
2016-04-30 14:44:05 -04:00
Eric Haszlakiewicz
4e0c8b55fb Merge pull request #220 from hschaa/master
Add utility function for comparing json_objects
2016-04-30 14:42:16 -04:00
Eric Haszlakiewicz
afa9f824e7 Merge pull request #222 from chenha0/master
Fix issue #221: JSON_C_TO_STRING_NOSLASHESCAPE works incorrectly
2016-04-30 14:40:30 -04:00
Eric Haszlakiewicz
02a2151b2b Merge pull request #223 from minaguib/master
Clarify json_object_get_string documentation of NULL handling & return
2016-04-30 14:36:02 -04:00
Mina Naguib
138c2a6b97 Clarify json_object_get_string documentation of NULL handling & returning 2016-02-07 20:55:25 -05:00
chenha0
dffdee966f Fix issue #221: JSON_C_TO_STRING_NOSLASHESCAPE works incorrectly
Tests added.
2016-01-21 20:12:48 +08:00
Helmut Schaa
dec5fcd50b Add some basic tests for verifying json_object_equal behavior
Do some basic checks on ints, doubles, strings, arrays and "complex" objects.
2016-01-13 15:56:39 +01:00
Helmut Schaa
00e475c434 Add utility function for comparing json_objects 2016-01-13 15:56:38 +01:00
Even Rouault
77a4276a8c Fix various potential null ptr deref and int32 overflows
This fix errors that can happen when ingesting very large JSON files
when hitting the maximum heap size of the process.
2016-01-11 12:15:54 +01:00
Eric Haszlakiewicz
537f8bcbdb Add const qualifiers to several functions that don't modify the json_object. 2015-12-26 21:42:18 +00:00
Eric Haszlakiewicz
882b7d95cc Issue #137: remove config.h.in from change control. 2015-12-08 21:20:42 -06:00
Eric Haszlakiewicz
980cdd61be Merge commit '2be921d88376e78f84d79aafa6db2714da804e59' 2015-12-08 20:51:06 -06:00
Eric Haszlakiewicz
65be8275da Merge pull request #209 from rgerhards/fix-regression
fix regression from 2d549662be
2015-11-29 21:24:50 -05:00
Eric Haszlakiewicz
316da85818 Fix issue #201: add a JSON_C_TO_STRING_NOSLASHESCAPE flag to turn off escaping of forward slashes. 2015-11-28 20:00:30 -06:00
Eric Haszlakiewicz
5a6a378725 Merge pull request #198 from unmole/master
Fix possible memory leak and remove superfluous NULL checks before free()
2015-11-28 13:58:07 -05:00
Rainer Gerhards
36610fb697 fix regression from 2d549662be
That commit introduced read-only keys, but when the hash table
was resized, that attribute was not preserved. This resulted in
an invalid free at time of table destruction.
2015-11-19 11:05:15 +01:00
Eric Haszlakiewicz
c97bbd3797 Merge pull request #199 from Nzbuu/fix_vs_build
Fix build in Visual Studio
2015-11-14 23:31:15 -05:00
Eric Haszlakiewicz
b82a51a5cd Merge pull request #200 from Nzbuu/ci_build
Add build scripts for CI platforms
2015-11-14 23:30:38 -05:00
James Myatt
239c146a4b Appveyor: Visual Studio v140 no longer fails 2015-11-05 13:50:30 +00:00
James Myatt
fd43c2b99a Appveyor: Create artefact with library and include files only 2015-11-05 13:45:01 +00:00
Eric Haszlakiewicz
80c1f69b9e Use AX_APPEND_COMPILE_FLAGS() to check the various compile flags, such as -Wall, to ensure the compile supports. 2015-10-23 02:16:40 +00:00
Eric Haszlakiewicz
10d50aadf2 Remove the AC_FUNC_MALLOC check, since we don't depend on the malloc(0) behavior it checks for, and we don't provide a rpl_malloc() implementation anyway. 2015-10-22 02:57:13 +00:00
James Myatt
82030cd0af Travis: add osx and clang builds 2015-10-09 23:58:02 +01:00
James Myatt
88dedb8824 Travis: skip install step 2015-10-09 23:58:01 +01:00
James Myatt
f786feac0a Add Travis build script 2015-10-09 23:58:00 +01:00
James Myatt
17e11e2c92 Appveyor: Allow failing builds against newest toolset 2015-10-09 23:54:14 +01:00
James Myatt
f6f8436e97 Add initial version of Appveyor build script 2015-10-09 23:54:13 +01:00
James Myatt
3f012eb0f8 Fix build in Visual Studio 2015-10-09 23:24:55 +01:00
Anmol Sarma
467102fa78 Remove superfluous NULL checks 2015-10-01 14:14:03 +05:30
Anmol Sarma
f37b0a10a5 Fix possible memory leak 2015-10-01 14:09:09 +05:30
Eric Haszlakiewicz
12916e229c Merge pull request #196 from rgerhards/improve-performance
Performance improvements
2015-09-28 22:25:29 -04:00
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
1757a31750 Fix doc for json_object_new_boolean() to indicate the correct value for TRUE (1). 2015-08-23 00:08:14 -04:00
Eric Haszlakiewicz
d4f8f92eb0 Squash deprecated function warning by replacing json_object_object_get calls with json_object_object_get_ex in test_cast. 2015-08-23 00:06:36 -04:00
Eric Haszlakiewicz
93b1fe63e5 Add back in the __attribute__((__unused__)) that was lost in the previous commit.
It's needed to squash a "variable 'val' set but not used" warning.
2015-08-23 00:00:12 -04:00
Eric Haszlakiewicz
a8bbefbbb4 Merge pull request #183 from cryogen/master
Apply compile warning fix to master branch
2015-08-22 15:24:26 -04:00
Eric Haszlakiewicz
55530bfc0f Merge pull request #186 from Virtual-Instruments/master
Syntax error
2015-08-05 23:19:19 -04:00
Jacob Alexander
e8a302017f Syntax error
- ./configure would fail due to bad code generation
2015-06-02 14:34:51 -07:00
Eric Haszlakiewicz
b594c34f57 Merge pull request #174 from haata/master
Adding JSON_C_TO_STRING_PRETTY_TAB flag
2015-05-31 12:10:13 -07:00
Jacob Alexander
92d4cf15f0 Adding JSON_C_TO_STRING_PRETTY_TAB flag
- Tabs are easier to read for tired eyes and editor adjustable
2015-05-27 17:37:39 -07:00
Eric Haszlakiewicz
cd8bd7f617 Tell the compiler we're intentionally ignoring the return value from __sync_val_compare_and_swap(). 2015-05-26 19:02:19 -07:00
Stuart Walsh
75d7409c4e Fix uninitialised variable compile warning, and also fix unused-when-used warning 2015-05-10 09:21:28 +01:00
Eric Haszlakiewicz
cbedf2f7ca Merge pull request #149 from cicku/patch-2
SONAME bump
2015-05-09 21:35:22 -04:00
Eric Haszlakiewicz
e4fce5d6ae Merge pull request #171 from Nzbuu/vs2010_build
Update configuration for VS2010 and win64
2015-05-08 21:31:37 -04:00
Eric Haszlakiewicz
e1eb298de1 Merge pull request #182 from tpetazzoni/libm-fix
Link against libm when needed
2015-05-08 21:19:48 -04:00
Eric Haszlakiewicz
82a1316f76 Merge pull request #180 from yegorich/silent
Enable silent build by default
2015-05-08 21:19:05 -04:00