| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a recent regression since commit
6359b798479d379a3202e02c6a938d9b40c0d856 which added various assert(0)
calls (often replacing return-s).
With Ming-W64 compiler, json-c build was failing with various errors of
the sort:
> /home/jehan/dev/src/json-c/json_object.c: In function 'json_object_int_inc':
> /home/jehan/dev/src/json-c/json_object.c:841:1: error: control reaches end of non-void function [-Werror=return-type]
> 841 | }
> | ^
> In file included from /home/jehan/dev/src/json-c/json_object.c:17:
> /home/jehan/dev/src/json-c/json_object.c: In function 'json_object_get_double':
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/assert.h:76:4: error: this statement may fall through [-Werror=implicit-fallthrough=]
> 76 | (_assert(#_Expression,__FILE__,__LINE__),0))
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/jehan/dev/src/json-c/json_object.c:1070:7: note: in expansion of macro 'assert'
> 1070 | assert(0);
> | ^~~~~~
> /home/jehan/dev/src/json-c/json_object.c:1072:3: note: here
> 1072 | case json_type_boolean:
> | ^~~~
The problem is that Mingw-w64 does not consider assert() as a noreturn
(even assert(0)), because it has to be compatible by Microsoft
libraries. See the discussion here:
https://sourceforge.net/p/mingw-w64/bugs/306/
Instead let's create a new json_abort() function which is basically just
an abort() function with an optional message, for such cases where
abortion was non-conditional (using assert() and using the assertion
condition as a message here was clearly a misuse of the function). And
mark json_abort() as 'noreturn', as well as 'cold' for optimization
purpose (this is code we expect to never run, unless there is a bug,
that is).
Finally let's use this json_abort() instead of previous misused assert()
calls.
|
|
|
|
| |
json_object_equal().
|
| |
|
|
|
|
| |
conversion for int64/uint64
|
|
|
|
| |
uint64},...}
|
| |
|
|
|
|
| |
json_object_new_double_s() to avoid potential conflicts with user code that uses the json_object_userdata_to_json_string serializer. Also, document the serializer-resetting behavior of json_object_set_double().
|
|
|
|
| |
the current serializer is the one that json_object_new_double_s() used.
|
| |
|
|
|
|
| |
escapes, define __func__ and omit unistd.h if needed.
|
|
|
|
|
|
|
|
| |
warning.
Though we will no longer be comparing exactly against INT64_MAX, this is ok
because any value of that magnitude stored in a double will *also* have been
rounded up, so the comparison will work appropriately.
|
| |
|
|\
| |
| | |
Fixed misalignment in JSON string due to space after \n being printed...
|
| | |
|
| |
| |
| |
| | |
choosing JSON_C_TO_STRING_SPACED together with JSON_C_TO_STRING_PRETTY in json_object_array_to_json_string
|
|\ \
| | |
| | | |
json_object_private: save 8 bytes in struct json_object in 64-bit arc…
|
| |/
| |
| |
| |
| |
| |
| | |
- there is no need for _ref_count to be uint_fast32_t (the compiler
might decide to use a 64-bit int). make it uint32_t instead.
- reorder the 32-bit integer fields (o_type and _ref_count) so that
there is no wasted 4-byte gap after each of them.
|
|\ \
| | |
| | | |
json_object.c:set errno in json_object_get_double()
|
| |/
| |
| |
| | |
closes #422
|
|/
|
|
|
|
| |
I also added a couple trivial, but related, suggestions.
closes #460
|
|
|
|
| |
isspace) so we don't crash when asserts are enabled on certain platforms and characters > 128 are parsed.
|
| |
|
|
|
|
|
|
| |
because some custom formats *will* include it (e.g. %.2f).
Also try to accomodate formats to explicitly exclude the decimal (e.g. %.0f).
|
| |
|
| |
|
| |
|
|
|
|
| |
optimizer hint. Also, rename that function from json_object_sizeof().
|
| |
|
|
|
|
| |
warnings from VS2015. See also PR#384.
|
| |
|
|
|
|
| |
json_type_string's with the default serializer set, and provide a way for people using custom serializers to provide a custom shallow_copy method.
|
| |
|
|\
| |
| |
| | |
commodo-json_deep_copy
|
| |
| |
| |
| |
| |
| |
| |
| | |
Because doing `json_tokener_parse(json_object_get_string(src))`
feels sloppy, dirty, and makes me want to cry at night
sometimes.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
|
|/
|
|
| |
"int64" variant since we store 64-bit values internally anyway.
|
| |
|
|
|
|
| |
Found with autofuzz in GDAL
|
| |
|
| |
|
|\
| |
| | |
merge upstream
|
| |
| |
| |
| | |
even if --enable-threading wasn't specified.
|
| |
| |
| |
| | |
__sync_add_and_fetch()/__sync_sub_and_fetch() function when it is specified.
|
| |
| |
| |
| |
| |
| | |
__GNUC__ define.
Add a comment mentioning the limitation even though the _ref_count value is hanled atomically.
|
| |\
| | |
| | |
| | | |
This is EmielBruijntes' "Atomic updates for the refcount"
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
compiler), which allows passing json objects between threads
|
|\ \ \
| |/ /
| | | |
want to merge the original repository
|
| | |
| | |
| | |
| | | |
string is terminated.
|