Isaac Hier
d8798468c6
Upgrade CMake to 3.1 for Hunter
2018-03-11 09:34:45 -04:00
Petri Lehtinen
d098c0ff86
Merge pull request #400 from coreyfarrell/branch-coverage
...
Enable branch coverage reporting.
2018-02-20 15:39:36 +02:00
Petri Lehtinen
2d494c169f
Merge pull request #398 from coreyfarrell/test-coverage
...
Improve test coverage.
2018-02-20 15:39:19 +02:00
Corey Farrell
a5af280bac
Enable branch coverage reporting.
2018-02-20 03:09:03 -05:00
Corey Farrell
73c22de516
Improve test coverage.
...
* Test equality of different length strings.
* Add tab to json_pack whitespace test.
* Test json_sprintf with empty result and invalid UTF.
* Test json_get_alloc_funcs with NULL arguments.
* Test invalid arguments.
* Add test_chaos to test allocation failure code paths.
* Remove redundant json_is_string checks from json_string_equal and
json_string_copy. Both functions are static and can only be called
with a json string.
Fixes to issues found by test_chaos:
* Fix crash on OOM in pack_unpack.c:read_string().
* Unconditionally free string in string_create upon allocation failure.
Update load.c:parse_value() to reflect this. This resolves a leak on
allocation failure for pack_unpack.c:pack_string() and
value.c:json_sprintf().
Although not visible from CodeCoverage these changes significantly
increase branch coverage. Especially in src/value.c where we previously
covered 67.4% of branches and now cover 96.3% of branches.
2018-02-15 10:12:31 -05:00
Petri Lehtinen
6dddf687d8
Merge pull request #396 from coreyfarrell/2.11
...
jansson 2.11
2018-02-11 20:11:41 +02:00
Corey Farrell
744fe5ed44
jansson 2.11
2018-02-09 12:31:18 -05:00
Petri Lehtinen
03620980cf
Merge pull request #395 from akheron/doc-utf-8
...
Document encoding requirements for callbacks
2018-02-09 10:10:34 +02:00
Petri Lehtinen
248d62111c
Merge pull request #368 from AmeyaVS/cmake_build_fix
...
Fix generated `pkg-config` file using cmake.
2018-02-09 09:45:36 +02:00
Petri Lehtinen
46dff2737d
Merge pull request #381 from phst/end-of-file-error-code
...
Use a more specific error code for premature end of input
2018-02-09 09:40:42 +02:00
Petri Lehtinen
fa0b5ece9e
Merge pull request #380 from phst/doc-error-code
...
document that json_error_code will be added in version 2.11
2018-02-09 09:39:38 +02:00
Petri Lehtinen
a6138a07b6
Document encoding requirements for callbacks
...
Original patch by @phst.
Fixes #369 .
2018-02-09 09:35:53 +02:00
Petri Lehtinen
2863dde053
Merge pull request #393 from akheron/json_sprintf
...
Add json_sprintf and json_vsprintf
2018-02-09 08:15:16 +02:00
Petri Lehtinen
efe6c7b3f2
Add json_sprintf and json_vsprintf
...
Fixes #392
2018-02-09 07:37:33 +02:00
Petri Lehtinen
3e81f78366
Merge pull request #389 from coreyfarrell/threadsafety
...
Atomic references and thread safe json_dump
2018-02-08 20:19:07 +02:00
Corey Farrell
8104ce167a
Merge pull request #1 from akheron/threadsafety
...
Clarify thread safety docs, rename JANSSON_THREAD_SAFE
2018-02-08 11:58:30 -05:00
Petri Lehtinen
f44921e176
Clarify thread safety docs, rename JANSSON_THREAD_SAFE
2018-02-08 12:38:14 +02:00
Corey Farrell
3aee856d7b
Docs: Update information on thread safety.
...
Fixes #387
2018-02-01 15:54:35 -05:00
Corey Farrell
37e0ee4d48
json_dump: Fix thread safety issue.
...
Circular reference detection in json_dump was not thread safe. Replace
visited flag with a hashtable_t.
Issue #387
2018-02-01 15:54:25 -05:00
Corey Farrell
dc3b313e91
Use thread-safe reference counting if supported by the compiler.
...
This makes use of __atomic or __sync builtin compiler functions to make
json_decref and json_incref thread-safe.
Issue #387
2018-01-29 14:17:58 -05:00
Philipp Stephani
45228cada4
Use a more specific error code for premature end of input
2017-12-20 18:27:04 +01:00
Philipp Stephani
24d45272a7
document that json_error_code will be added in version 2.11
2017-12-18 23:51:32 +01:00
Petri Lehtinen
9e5af7c3b7
Merge pull request #374 from coreyfarrell/always-steal
...
json_pack: Enable more complete stealing of references.
2017-12-16 20:35:14 +02:00
Corey Farrell
6c78910011
apiref: Clarify documentation for unpack O
format.
...
The `O` format causes reference counts to increase, but in an error they
are not released. Callers to unpack functions that use the `O` format
should use pointers pre-initialized to NULL so they can safely release
the reference on error.
Also corrected typo which said this was like `O` (itself).
Fixes #135
2017-12-13 14:04:07 -05:00
Corey Farrell
89dad8959b
json_object_iter_set_new: Fix error branch leak.
...
This function needs to release a reference to value if the other
arguments are invalid.
Issue #135
2017-12-13 14:04:07 -05:00
Corey Farrell
9a1d9c88fc
json_pack: Enable more complete stealing of references.
...
Users of the "o" format have an expectation that the object reference
will be stolen. Any error causes the collection process to end early.
This patch causes json_pack and related functions to continue scanning
the format and parameters so all references can be stolen to prevent
leaks. This makes no attempt to continue processing if the format
string is broken or missing.
'make check' still passes. Ran test_pack under valgrind and verified
that the leaked reference is fixed. Added a test which uses refcounts
to verify that the reference was correctly stolen after a NULL value
error.
Issue #135
2017-12-13 14:03:58 -05:00
Petri Lehtinen
02dade46c0
Merge pull request #375 from phniix/373_upstream_typo_in_cmakelists
...
Fixes akheron/jansson#373
2017-12-13 07:08:25 +02:00
Petri Lehtinen
bc5c6826ef
Merge pull request #377 from coreyfarrell/extra-refs
...
Remove extra reference actions in parsers.
2017-12-13 07:07:33 +02:00
Petri Lehtinen
217859f849
Merge pull request #378 from phst/doc
...
Document that length-aware string functions have been added in 2.7
2017-12-13 07:05:15 +02:00
Philipp Stephani
3951d39b40
Document that length-aware string functions have been added in 2.7
2017-12-10 16:53:01 +01:00
Corey Farrell
bd91753e91
Remove extra reference actions in parsers.
...
Make parse_object use json_object_set_new_nocheck and make parse_array
use json_array_append_new, remove json_decref from error and success
paths.
Fixes #376
2017-11-14 23:52:49 -05:00
Joe Hura
0b04762c94
Fixes akheron/jansson#373
...
'sys/time.h' is a typo, it should read: 'sys/types.h'
2017-11-07 19:32:14 +11:00
Petri Lehtinen
009ffa3fc8
Fix a compile error on macOS clang
...
Reported by Diederick Huijbers
2017-11-07 10:20:21 +02:00
Ameya Vikram Singh
89f0dde7ff
Fix generated pkg-config
file using cmake.
...
Fixed the generated `jansson.pc` with cmake to be consistent with the
one generated using GNU Autotools.
2017-10-29 23:57:25 +05:30
Petri Lehtinen
9e7847ed26
Merge pull request #365 from phst/bug352
...
Use last byte of error text as numeric error code
2017-10-09 08:07:42 +03:00
Philipp Stephani
112ccbd820
Use last byte of error text as numeric error code
...
Fixes #352
2017-10-03 11:42:07 +02:00
Petri Lehtinen
271ffda903
Make json_equal() const-correct
...
Fixes #344
2017-08-19 21:10:17 +03:00
Petri Lehtinen
3e5405c39e
Work around gcc's -Wimplicit-fallthrough
2017-08-19 21:09:32 +03:00
Petri Lehtinen
93e8cd7d68
Merge pull request #359 from sanjay24/master
...
json_dump_file API returns success even when fclose fails
2017-08-06 07:14:18 +03:00
Sanjay Kumar
0abcbce3bb
json_dump_file API returns success even when fclose fails (consider disk full case). API should check the return value of fclose before returning success to its caller. fwrite may not write anything into the file, it simply returns the number of bytes written into the buffer. When disk is full and fclose is called, it results in truncation of the file (resulting in zero sized file). Since, API is returning success, its caller can't take any remedial action on its failure.
2017-08-05 23:52:49 +05:30
Petri Lehtinen
4947f9a193
Merge pull request #356 from hellojaewon/master
...
Docs - Fix typo
2017-07-20 22:42:29 +03:00
최재원
ad6c1e37ad
Fix typo
2017-07-16 19:16:34 +09:00
Petri Lehtinen
f52c3da717
Merge pull request #339 from npmccallum/optpack
...
Enable optional object members in json_pack()
2017-04-19 16:17:28 +03:00
Nathaniel McCallum
28666cead0
Enable optional object/array members in json_pack()
2017-04-19 07:19:29 -04:00
Petri Lehtinen
74028ff958
Merge commit '1b8bebf0bf8f1c0c3d92faf67a830bf8448897ed'
2017-04-13 13:46:35 +03:00
Petri Lehtinen
fbf720f2c5
Allow forward declaring json_error_t values
2017-04-13 13:39:43 +03:00
Mathieu Lirzin
1b8bebf0bf
build: Use Autoconf macro @includedir@ for jansson.pc.
...
This is more consistent with what is done for other pkg-config
variables.
2017-04-12 22:36:58 +02:00
Petri Lehtinen
f7a70de84a
Merge pull request #336 from akheron/issue-333
...
CMakeLists.txt: Remove extra parenthesis
2017-03-29 07:31:26 +03:00
Petri Lehtinen
17f77cf2c6
CMakeLists.txt: Remove extra parenthesis
...
Fixes #333
2017-03-29 07:08:19 +03:00
Nathaniel McCallum
b23201bb1a
jansson 2.10
2017-03-02 20:49:42 +02:00