Commit Graph

1009 Commits

Author SHA1 Message Date
David Harvey-Macaulay
107cfe9499 Implemented json_pack() format specifiers 's?', 'o?', and 'O?'. 2016-02-23 19:28:56 +00:00
David Harvey-Macaulay
811965b475 Implemented json_pack() format specifiers 's?', 'o?', and 'O?'. 2016-02-22 21:32:20 +00:00
Petri Lehtinen
e08101704c Merge pull request #268 from wingyplus/fix-libdir-pkg-config
Fix libdir is wrong path when compile with cmake
2016-02-11 07:29:57 +02:00
Petri Lehtinen
c17be5870b Merge pull request #267 from Mephistophiles/master
Optimized functions
2016-02-11 07:26:00 +02:00
Thanabodee Charoenpiriyakij
9d71d006cc Fix libdir is wrong when compile with cmake
because JANSSON_INSTALL_LIB_DIR is set to /usr/local/lib after
foreach loop
2016-02-10 18:46:43 +07:00
Maxim Zhukov
b698ca13de [Optimized functions]
Optimized json_equal, json_delete, json_copy, json_deep_copy
Replaced if to switch
Removed unnecessary check for NULL.
2016-02-03 17:34:54 +03:00
Petri Lehtinen
0f50bb10b6 Fix a typo 2015-12-23 08:18:27 +02:00
Petri Lehtinen
e6b60da043 Update CHANGES 2015-12-23 08:17:18 +02:00
Petri Lehtinen
89f4c15e6d Change doc version to 2.8-dev
It's shown in the front page of readthedocs/latest.
2015-12-23 07:40:58 +02:00
Petri Lehtinen
1c2e707b34 Fix a comment 2015-12-23 07:40:02 +02:00
Petri Lehtinen
52015cf35c Merge pull request #263 from wking/display-first-unrecognized-key
pack_unpack: List first unrecognized key in strict unpacking
2015-12-23 07:38:03 +02:00
W. Trevor King
1d513d063a pack_unpack: List unrecognized keys in strict unpacking
Otherwise figuring out what's wrong with your JSON can be tricky,
especially if you're using a single fmt string to validate a large,
complicated schema.

The comma delimiting will make separating keys that contain commas
difficult.  For example:

  {"foo, bar": true, "baz": false}

will generate errors like:

  2 object item(s) left unpacked: foo, bar, baz

but that seems like a small enough corner case to not be worth much
worrying.

I wanted to find a way to handle this without have_unrecognized_keys,
but the strbuffer tooling makes it look like I shouldn't be reaching
in to do things like:

  strbuffer_t unrecognized_keys;
  unrecognized_keys.value = NULL;

and then using 'unrecognized_keys.value == NULL' in place of
have_unrecognized_keys.
2015-12-22 10:05:31 -08:00
Petri Lehtinen
581d5b899c Add versionadded to json_get_alloc_funcs doc 2015-12-22 13:05:28 +02:00
Petri Lehtinen
4f49c07781 Merge pull request #264 from npmccallum/master
Add json_get_alloc_funcs() to allow alloc function fetching
2015-12-22 13:01:36 +02:00
Nathaniel McCallum
245e532934 Add json_get_alloc_funcs() to allow alloc function fetching
This is particularly useful in modular situations where the allocation
functions are either unknown or private. For instance, in such cases,
the caller of json_dumps() has no way to free the returned buffer.
2015-12-21 11:46:32 -05:00
Petri Lehtinen
e44b2231b5 doc: Fix a broken link
Fixes #258
2015-10-20 10:21:08 +03:00
Petri Lehtinen
40bd71f064 Merge pull request #257 from denis2342/master
changed code from while to do/while
2015-10-14 08:54:37 +03:00
Denis Ahrens
067dc50efe changed code from while to do/while 2015-10-12 16:11:56 +02:00
Petri Lehtinen
4876bda857 Merge pull request #255 from gonzzor/snprintf_dump.c
Improve usage of snprintf in dump.c
2015-10-05 15:43:45 +03:00
Jonas Jonsson
e89538f685 Format %x expects unsigned int, not int
Be more explicit that a cast is happening.
2015-10-05 14:00:44 +02:00
Jonas Jonsson
f7331c7194 Use sizeof(seq) instead of magic number 13
Be more future proof by keeping the number of magic constants low.
2015-10-05 13:59:09 +02:00
Petri Lehtinen
02464862ed Merge pull request #248 from phoenix0428/patch-1
Update test_memory_funcs.c
2015-09-08 21:13:08 +03:00
Petri Lehtinen
db0213ae56 Merge pull request #252 from OlehKulykov/master
Buildable with MS Compiler version  >= 1900
2015-09-01 21:13:25 +03:00
OlehKulykov
8f2298bad8 Buildable with MS Compiler version >= 1900 2015-08-31 23:43:29 +02:00
Petri Lehtinen
4c4f692bd6 Add json_object_foreach_safe
Fixes #230.
2015-08-26 17:32:55 +03:00
Kinam Kim
875b78dc97 Update test_memory_funcs.c 2015-08-13 16:44:31 +09:00
Petri Lehtinen
fef27e6d3e Merge branch '2.7' 2015-05-19 08:54:13 +03:00
Petri Lehtinen
1dab656dee doc: Copying doesn't preserve key insertion order
Fixes #237.
2015-05-19 08:54:09 +03:00
Petri Lehtinen
69678aaa35 doc: Copying doesn't preserve key insertion order
Fixes #237.
2015-05-19 08:49:10 +03:00
Petri Lehtinen
d384acd706 Merge pull request #234 from flok99/master
Optimized dump_indent to reduce the number of fwrite calls.
2015-05-04 09:00:26 +03:00
Folkert van Heusden
5d42e1520a Optimized dump_indent to reduce the number of fwrite calls. 2015-05-01 15:18:53 +02:00
Petri Lehtinen
d8753db4ac Merge pull request #233 from haldean/master
Use snprintf and strncpy in place of sprintf and strcpy

OpenBSD linker nags about using sprintf and strcpy.
2015-04-30 10:43:39 +03:00
Haldean
95dd927857 use snprintf and strncpy in place of sprintf and strcpy
This is both good practice and nice for OpenBSD users, who will no
longer get the nag message to not use sprintf/strcpy every time they
link against jansson. It's worth noting that the existing code seems
safe to me - bounds checks were already happening before the actual
calls - and that this is for extra security.
2015-04-30 00:11:25 -07:00
Petri Lehtinen
76760011ff Don't crash when building documentation man pages
Fixes #207.
2015-03-07 09:14:06 +02:00
Petri Lehtinen
11813f4128 Fix a use after free 2015-02-07 07:36:29 +02:00
Petri Lehtinen
8b1bdcacb7 Merge pull request #221 from lioncash/test
test_object: Fix a duplicate conditional check in test_iterators
2015-02-05 09:28:43 +02:00
Lioncash
c242b46016 test_object: Fix a duplicate conditional check in test_iterators 2015-02-05 01:26:13 -05:00
Petri Lehtinen
58c188e1d5 Merge pull request #217 from JoakimSoderberg/simple_parse_cmake
Compile simple_parse example for CMake project.
2015-01-14 08:05:51 +02:00
Petri Lehtinen
ffc18128f4 Merge pull request #216 from JoakimSoderberg/infinity_warning
Disable warning for deliberate use on MSVS.
2015-01-14 08:04:37 +02:00
Joakim Soderberg
6a38d0d431 Disable warning for deliberate use on MSVS.
Disable "warning C4756: overflow in constant arithmetic" when deliberately
triggering it in a test using infinity.
2015-01-13 16:30:00 +01:00
Joakim Soderberg
d0a8ad4c06 Compile simple_parse example for CMake project. 2015-01-13 16:17:48 +01:00
Petri Lehtinen
c244b1483e examples/README.rst: Fix formatting 2014-12-30 08:56:07 +02:00
Petri Lehtinen
fc83f10c85 Add Makefile.am for examples 2014-12-30 08:50:33 +02:00
Petri Lehtinen
8d561cd94e examples/simple_parse.c: Reindent, fix warnings & style 2014-12-30 08:50:33 +02:00
Petri Lehtinen
970c6988a5 Merge pull request #214 from rdpoor/master
adding simple-parse example
2014-12-30 08:33:34 +02:00
Robert Poor
220dcb7be3 use fgets() rather than getline() 2014-12-29 06:22:19 -08:00
Robert Poor
48e0488f07 adding simple-parse example 2014-12-26 10:49:15 -08:00
Petri Lehtinen
890760b2fb Increase test coverage 2014-12-19 08:35:46 +02:00
Petri Lehtinen
15653c47dd Add a test case for \u0000 2014-12-19 07:57:33 +02:00
Petri Lehtinen
5508ab403d Honor JSON_DECODE_INT_AS_REAL at lexical stage
This has the consequence that numbers are never converted to integers
when JSON_DECODE_INT_AS_REAL is set, and thus it works correctly all
integers that are representable as double.

Fixes #212.
2014-12-18 15:16:14 +02:00