| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Avoid compiler warnings when running with `-Wunused-parameter`.
|
|
|
|
|
| |
When running with `-Wsign-compare` we're raising a lot of
signed/unsigned comparison warnings.
|
|
|
|
|
|
|
|
| |
This will give more informative message in case of fail assertions.
Moreover GLib (when compiling with G_DISABLE_ASSERT) disable g_assert
totally, that would make these tests no-op
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
|
|
|
|
|
|
|
|
|
| |
The current iterator API does not guarantee the iteration order, as it's
based off of the hash table iterator. JsonObject, though, can guarantee
the iteration order—we do that for json_object_foreach_member().
Instead of changing the behaviour of json_object_iter_next(), we can add
API to initialize and iterate a JsonObjectIter in insertion order.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using the typed getters for JsonObject, the existing API will
automatically fail if the member requested is not present. This is
generally good practice, because JSON data typically does not have a
schema, and thus is has to be validated "on the go"; a JSON object
member that contains `null`, or `0`, or `false`, is indistinguishable
from a JSON object member that does not exist, so we cannot simply
return a scalar value and be done with it.
We can provide an escape hatch, though, for the crowd writing parsers
for JSON data; by using Python as the model, we can add methods that
take a default value as a parameter, and return it as a fallback value
if the requested object member does not exist, or if it's set to `null`.
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 028e540 disallowed empty member names in objects, however
they are unfortunately valid JSON. This patch reenables an empty
string as a member name.
Tests are updated to allow the empty string case, and to test
the use of an empty string in generation, iteration etc.
https://bugzilla.gnome.org/show_bug.cgi?id=747279
|
|
|
|
|
|
|
|
|
|
| |
This is a stack-allocated iterator object similar to GHashTableIter
which allows allocation-free iteration over the members in a JsonObject.
It differs from json_object_foreach_member() in the order in which it
iterates — for JsonObjectIter the order is undefined.
https://bugzilla.gnome.org/show_bug.cgi?id=755509
|
|
|
|
|
| |
We depend on a new version of GLib, so we can remove a bunch of old
version checks.
|
|
|
|
|
|
|
|
| |
Starting from GLib 2.36, g_type_init() is going to be deprecated (the
type system will be initialized as soon as libgobject is paged in, using
constructors). As I don't want to bump dependencies just for that, the
call to g_type_init() should be placed under a compile-time version
check, to keep the noise from compiler warnings down.
|
| |
|
| |
|
|
It's pointless to add the '-test' suffix to files under the tests/ directory.
|