Commit Graph

421 Commits

Author SHA1 Message Date
Eric Haszlakiewicz
9a2915ce66 Merge branch 'fixes-for-upstream' of https://github.com/doctaweeks/json-c into doctaweeks-fixes-for-upstream 2016-05-23 02:08:28 +00:00
Eric Haszlakiewicz
b2c5969aff Merge pull request #193 from jplitza/master
Make serialization format of doubles configurable
2016-05-18 16:10:27 -04:00
Jan-Philipp Litza
21dc5dc92b Export json_object_double_to_json_string() and use custom format string 2016-05-06 16:12:44 +02:00
Jan-Philipp Litza
2200ffa8b0 Fix code in docs for json_object_new_double_s() 2016-05-06 16:12:19 +02:00
Eric Haszlakiewicz
3345b25962 Add tests for the json_object_array_del_idx() function. 2016-04-30 19:09:45 +00:00
Eric Haszlakiewicz
9edf2418e0 Merge branch 'Protovision-master' 2016-04-30 18:53:16 +00:00
Eric Haszlakiewicz
1fb87cd196 Merge branch 'master' of https://github.com/Protovision/json-c into Protovision-master 2016-04-30 18:52:47 +00:00
Eric Haszlakiewicz
e3fb74942a Merge pull request #216 from Jehan/master
configure: check realloc with AC_CHECK_FUNCS() to fix cross-compilation.
2016-04-30 14:45:16 -04:00
Eric Haszlakiewicz
c6a97eb9ce Merge pull request #218 from sevan/patch-1
Use a macro to indicate C99 to the compiler
2016-04-30 14:44:29 -04:00
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
Sevan Janiyan
7150b7f28d Use a macro to indicate C99 to the compiler
The [AC_PROG_CC_C99 macro](https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/C-Compiler.html) sets the complier to the C99 standard if the compiler does not default to such behaviour (albeit gnu99). This is better than specifically hardcoding flags
2016-01-05 11:43:17 +00:00
Jehan
79c99aeb2b configure: check realloc with AC_CHECK_FUNCS() to fix cross-compilation.
AC_FUNC_REALLOC is messed up when cross-compiling, ending up in failed
build with "undefined reference to `rpl_realloc'" error.
AC_CHECK_FUNCS will work both with native and cross builds.
2016-01-01 18:46:02 +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
Daniel M. Weeks
92e9a5032b Use size_t for json object array ops 2015-11-24 14:00:32 -05:00
Daniel M. Weeks
45c56b80c4 Use size_t for array list length and size 2015-11-24 14:00:31 -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