summaryrefslogtreecommitdiff
path: root/json_object.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | | fixed wrong object name in json_object_all_values_equalAlexey Konovalov2016-09-271-1/+1
|/ /
* | Issue #260: add a check to prevent trivial loops in the object tree, even ↵Eric Haszlakiewicz2016-08-201-0/+6
| | | | | | | | though it is up to the callers to avoid doing so in more complex cases.
* | json_object_object_add_ex() should have shared code with ↵Eric Haszlakiewicz2016-08-201-26/+11
| | | | | | | | | | | | json_object_object_add(), and been changed to return int at the same time the latter was. Do that now. Also correct a couple of calls to _to_json_string to check the return value.
* | Revert bogus change to json_object_get() made in f40b08d8 that caused it to ↵Eric Haszlakiewicz2016-08-111-1/+1
| | | | | | | | | | | | | | | | always return NULL. (Issue #259) Also undo NULL check in json_tokener_set_flags(): it's not at all valid toi try to set flags on a NULL pointer, and doing so should not be silently ignored.
* | Merge pull request #255 from RyDroid/minor-c2Eric Haszlakiewicz2016-08-101-23/+30
|\ \ | | | | | | Minor changes in C source code
| * | Minor changes in C source codeNicola Spanti (RyDroid)2016-08-081-23/+30
| | |
* | | Add method 'json_object_to_json_string_length'jobol2016-07-271-9/+24
|/ / | | | | | | | | | | | | | | | | | | This new method allows to also get the length of the generated string. Fix #165 Change-Id: Iea91404027f143ca3d29a4c58d7c07ae53556110 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
* | Issue #236: Add -Wcast-qual and fix casts to retain constness.Eric Haszlakiewicz2016-06-111-13/+13
| | | | | | | | | | To better distinguish between entry->k and entry->v being const within linkhash, but non-const outside, add lh_entry_v() and lh_entry_k() accessors. Make lh_entry->k const.
* | Add public API to get and set userdataMatthias Schiffer2016-05-291-9/+16
| | | | | | | | | | Also, json_object_set_serializer is changed to respect the userdata and user_delete parameters when to_string_func is NULL.
* | Make default double serializer ignore userdata againMatthias Schiffer2016-05-291-7/+27
| | | | | | | | | | | | | | | | The user might want to use the userdata for something different, so the serializer should ignore it by default. Explicitly setting the serializer to json_object_double_to_json_string will still make it interpret the userdata as a format string.
* | Fix a few places that needed adjustment for the size_t changes, including ↵Eric Haszlakiewicz2016-05-231-2/+2
| | | | | | | | updating the range checks to use a calculated SIZE_T_MAX.
* | Merge branch 'fixes-for-upstream' of https://github.com/doctaweeks/json-c ↵Eric Haszlakiewicz2016-05-231-4/+4
|\ \ | | | | | | | | | into doctaweeks-fixes-for-upstream
| * | Use size_t for json object array opsDaniel M. Weeks2015-11-241-4/+4
| |/
* | Export json_object_double_to_json_string() and use custom format stringJan-Philipp Litza2016-05-061-6/+6
| |
* | Merge branch 'master' of https://github.com/Protovision/json-c into ↵Eric Haszlakiewicz2016-04-301-0/+5
|\ \ | | | | | | | | | Protovision-master
| * | Added array_list_del_idx and json_object_array_del_idxMark Swoope2015-04-021-0/+4
| | |
* | | Merge pull request #219 from rouault/low_heap_robustness_fixesEric Haszlakiewicz2016-04-301-0/+5
|\ \ \ | | | | | | | | Fix various potential null ptr deref and int32 overflows
| * | | Fix various potential null ptr deref and int32 overflowsEven Rouault2016-01-111-0/+5
| | | | | | | | | | | | | | | | | | | | This fix errors that can happen when ingesting very large JSON files when hitting the maximum heap size of the process.
* | | | Merge pull request #220 from hschaa/masterEric Haszlakiewicz2016-04-301-0/+81
|\ \ \ \ | | | | | | | | | | Add utility function for comparing json_objects
| * | | | Add utility function for comparing json_objectsHelmut Schaa2016-01-131-0/+81
| |/ / /
* | | | Fix issue #221: JSON_C_TO_STRING_NOSLASHESCAPE works incorrectlychenha02016-01-211-6/+6
|/ / / | | | | | | | | | Tests added.
* | | Add const qualifiers to several functions that don't modify the json_object.Eric Haszlakiewicz2015-12-261-15/+15
| | |
* | | Merge commit '2be921d88376e78f84d79aafa6db2714da804e59'Eric Haszlakiewicz2015-12-081-3/+8
|\ \ \
| * | | Fixed json_object_object_add().Alexander Klauer2013-01-081-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Return value of json_object_object_add() changed from void to int. Return value now indicates success or failure. * Check whether allocations are successful. * Do not exit program from within the library.
* | | | Fix issue #201: add a JSON_C_TO_STRING_NOSLASHESCAPE flag to turn off ↵Eric Haszlakiewicz2015-11-281-3/+9
| |_|/ |/| | | | | | | | escaping of forward slashes.
* | | Fix build in Visual StudioJames Myatt2015-10-091-2/+2
| | |
* | | Merge pull request #196 from rgerhards/improve-performanceEric Haszlakiewicz2015-09-281-28/+76
|\ \ \ | | | | | | | | Performance improvements
| * | | more efficient handling for smalls strings inside json_objectRainer Gerhards2015-09-231-23/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | remove unneeded data items from hashtable codeRainer Gerhards2015-09-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | add json_object_object_add_ex() APIRainer Gerhards2015-09-231-2/+28
| | | | | | | | | | | | | | | | | | | | This provides more control over some detail aspects, many of which are performance related.
| * | | reduce duplicate hash computation in json_object_object_add()Rainer Gerhards2015-09-221-2/+4
| | | | | | | | | | | | | | | | This can be a very considerable performance saver.
* | | | Merge pull request #174 from haata/masterEric Haszlakiewicz2015-05-311-1/+8
|\ \ \ \ | | | | | | | | | | Adding JSON_C_TO_STRING_PRETTY_TAB flag
| * | | | Adding JSON_C_TO_STRING_PRETTY_TAB flagJacob Alexander2015-05-271-1/+8
| | |_|/ | |/| | | | | | | | | | - Tabs are easier to read for tired eyes and editor adjustable
* | | | Use more appropriate castsJames Myatt2015-03-041-3/+3
|/ / /
* | | Slight style tweaks to the bsearch changest.Eric Haszlakiewicz2015-03-041-7/+5
| | |
* | | add bsearch for arraysAlexander Dahl2014-08-211-0/+17
|/ / | | | | | | | | | | Arrays can already be sorted with json_object_array_sort() which uses qsort() of the standard C library. This adds a counterpart using the bsearch() from C.
* | Check for failures when allocating memory; return NULL and set errno=ENOMEM ↵Eric Haszlakiewicz2014-04-191-1/+26
| | | | | | | | | | | | in a few of those cases. Thanks to Susant Sahani for pointing out some of these.
* | Reformat some code in json_object.cEric Haszlakiewicz2014-04-191-198/+231
| |
* | Issue#114: check for the presence of isnan and isinf, and provide compat ↵Eric Haszlakiewicz2014-03-021-0/+1
| | | | | | | | macros on MSCV where _isnan and _finite exist instead.
* | Avoid potential overflow in json_object_get_doubleKeith Derrick2013-10-011-1/+32
| | | | | | | | | | | | | | | | | | sscanf is always a potential problem when converting numeric values as it does not correctly handle over- and underflow (or at least gives no indication that it has done so). This change converts json_object_get_double() to use strtod() according to CERT guidelines.
* | Issue #59: change the floating point output format to %.17g so values with ↵Eric Haszlakiewicz2013-09-111-1/+1
| | | | | | | | more than 6 digits show up in the output.
* | Use sizeof instead of hard coded values when calling snprintf.Eric Haszlakiewicz2013-09-111-4/+4
| |
* | Added a json_object_new_double_s() convenience function to allow an exact ↵Eric Haszlakiewicz2013-09-111-5/+30
| | | | | | | | | | | | string representation of a double to be specified when creating the object and use it in json_tokener_parse_ex() so a re-serialized object more exactly matches the input. Add json_object_free_userdata() and json_object_userdata_to_json_string() too.
* | Merge pull request #96 from rouault/remove_strdnupEric Haszlakiewicz2013-09-081-4/+0
|\ \ | | | | | | Remove redefinition of strndup() which is no longer used in the codebase
| * | Remove redefinition of strndup() which is no longer used in the codebaseEven Rouault2013-08-121-4/+0
| | |
* | | fixing problem that isinf(-Inf) can be 1 or -1Taneli Mielikainen2013-08-041-4/+5
|/ /
* | Merge pull request #89 from ayanes/masterEric Haszlakiewicz2013-06-181-1/+13
|\ \ | | | | | | Support NaN and Infinity
| * | Fixes for Infinity and NaNAdrian Yanes2013-06-121-1/+13
| | | | | | | | | | | | | | | | | | Although JSON RFC does not support NaN or Infinity as numeric values ECMA 262 section 9.8.1 defines how to handle these cases as strings
* | | snprintf definition is needed here, tooAnatol Belski2013-06-041-0/+7
|/ /
* | Merge branch 'remicollet-issue-float'Eric Haszlakiewicz2013-02-261-1/+22
|\ \ | | | | | | | | | | | | Conflicts: json_util.c