summaryrefslogtreecommitdiff
path: root/json-glib
Commit message (Collapse)AuthorAgeFilesLines
* json-gvariant: Stop string to GVariant conversion failing due to unrelated ↵Robert Ancell2020-04-071-11/+33
| | | | | | | | | | errno changes This was observed as failing due to some codepath inside g_variant_new_string setting errno to EAGAIN. Json Glib was erroneously detecting this in the checks designed to catch string to integer conversions. Solved by making errno only checked after the integer conversions.
* tests: Fix some memory leaks in the testsPhilip Withnall2018-03-133-1/+5
| | | | | | | | | | | We can’t do this by porting to g_autoptr(), because json-glib needs to be buildable using MSVC. Sad panda. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/json-glib/issues/30 (cherry picked from commit 43b9703970a6d5f2fc53f828ab8d29195ab01583) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* json-parser: Fix a memory leak on two error handling pathsPhilip Withnall2018-03-131-0/+2
| | | | | | | | | | | Small leak. With some additional fixes to the tests themselves, this makes all the tests run valgrind-clean. (See the following commit.) Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/json-glib/issues/30 (cherry picked from commit 96d591b5708ef9dfb4c02d2ae39b891f903d8a58) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* json-parser: Fix getting immutable root nodes from empty inputPhilip Withnall2018-03-132-10/+31
| | | | | | | | | | | | | | | | If parsing an empty document, it’s allowed to return NULL from json_parser_get_root(). This was broken for immutable parsers when immutability support was added (an assertion fails). Fix that, and also document that json_parser_get_root() may return NULL. Do the same for json_parser_steal_root() too, which is another way that the root node may be NULL. Add a unit test. Signed-off-by: Philip Withnall <withnall@endlessm.com> (cherry picked from commit ef5707cd0b8d1a1a4ab4edf9ae58c7b3176ef93b) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* json-node: Clarify documentation regarding programmer errorsPhilip Withnall2018-03-131-19/+33
| | | | | | | | | | | | | | Despite my efforts in commit 011c1e424b7 (parts of which were completely incorrect), the JsonNode documentation still wasn’t particularly helpful about differentiating between methods which return NULL if the JsonNode is not of the right type, and methods which emit a critical warning. Try and improve that across the board, hopefully without saying blatantly incorrect things this time. Signed-off-by: Philip Withnall <withnall@endlessm.com> (cherry picked from commit acb22e9e18c2a5bf93ed82af4d8194341acfdc01) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* node: Use json_node_unref for the JsonNode autoptr cleanupRobert Ancell2018-03-131-1/+1
| | | | | | | | | json_node_unref was added after the autoptr macros were written. This fixes an assertion failure if using autoptr and json_node_ref. (cherry picked from commit 0df2466103ff706e980e82cd560232fdd2ba1baa) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* Update json-enum-types.h.inRavish Bhatia2018-03-131-1/+1
| | | | | (cherry picked from commit b577c363c501116bffa08af27090e38d74b430c6) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* Use fuzzy comparison for floating point valuesEmmanuele Bassi2017-11-044-32/+14
| | | | | | Direct comparison should never be used for floating point values. Fixes #27 and #28.
* Add float comparison utility macros for testsEmmanuele Bassi2017-11-041-0/+21
| | | | | We do compare floating point values elsewhere in our code, so we should ensure that we're doing that with a certain amount of fuzziness.
* build: Clean up configuration optionsEmmanuele Bassi2017-09-121-1/+1
| | | | | Drop the Autotool-isms, and use something more in line with what Meson expects for configuration options.
* build: Rework the introspection optionEmmanuele Bassi2017-09-051-0/+2
| | | | | | | | | | | Instead of using `disable_introspection=false`, flip the condition around, and use `enable-introspection=true`. This avoids the double negative. Additionally, we should drop the cross-compilation check; it's entirely possible to cross-compile introspection data for different platforms and architectures; this allows the Yocto project to drop a patch for JSON-GLib.
* Merge branch 'master-old'Emmanuele Bassi2017-07-108-81/+91
|\
| * generator: Add an GString-based methodGarrett Regier2017-06-162-11/+34
| | | | | | | | | | | | This allows callers to avoid extra allocations when dumping to a preexisting string. https://bugzilla.gnome.org/show_bug.cgi?id=773504
| * core: Avoid json_object_get_members()Garrett Regier2017-06-167-52/+47
| | | | | | | | | | | | | | Use JsonObject's private members_ordered GQueue instead. This avoids a g_list_copy(). https://bugzilla.gnome.org/show_bug.cgi?id=773504
| * object: Use a GQueue for members_orderedGarrett Regier2017-06-162-19/+11
| | | | | | | | | | | | | | | | This makes the list always ordered and removes the g_list_reverse() in json_object_get_members(). https://bugzilla.gnome.org/show_bug.cgi?id=773504
* | gobject: Ignore deprecation warning for g_object_newv()Emmanuele Bassi2017-07-101-0/+2
| | | | | | | | | | We're going to replace it once we bump the dependency on GObject, to avoid a nasty ifdef hell.
* | build: Test all common compiler and linker flagsEmmanuele Bassi2017-07-101-12/+1
| | | | | | | | | | | | | | | | Instead of assuming some compiler and linker flags will work depending on the platform, we should test them all. Additionally, we should move all the compiler and linker flag checks in the same place.
* | build: Silence the introspection scannerEmmanuele Bassi2017-07-101-0/+1
| | | | | | | | We are only interested in warnings and errors.
* | build: Coding style clean upsEmmanuele Bassi2017-07-101-9/+9
| |
* | build: Clean up the hard-coded API version numbersEmmanuele Bassi2017-07-102-8/+8
|/ | | | | | In order to be resilient towards future API bumps, we should have very few places that deal with the API version encoded inside paths and file names.
* build: Move ancillary build scripts to a separate directoryEmmanuele Bassi2017-06-032-22/+0
| | | | | Avoid cluttering the source directories, and makes finding things easier.
* build: Clean up installed tests rulesEmmanuele Bassi2017-06-031-8/+10
| | | | Use variables for common values, instead of duplicating them.
* build: Don't copy test data in the build directoryEmmanuele Bassi2017-04-011-9/+6
| | | | | | GTest can use environment variables to find the test data in the source and build directory, so we don't need to copy files around using Python scripts.
* build: Use the Meson 'python3' moduleEmmanuele Bassi2017-04-011-1/+1
| | | | | | | This allows finding Python3 on Windows, in order to build and run the tests. https://bugzilla.gnome.org/show_bug.cgi?id=780550
* build: Fix the installed test wrapper fileEmmanuele Bassi2017-03-291-1/+1
| | | | | We need to point to the binary, but we're using the wrong name for the Exec key.
* docs: Clarify when NULL might be returnedMatthew Leeds2017-03-181-13/+14
| | | | | | | | | If a JsonObject has no members, json_object_get_members() and json_object_get_values() will return NULL, so this commit makes that behavior clear in the docs. It also adds the (nullable) annotation in a few places in the same file. https://bugzilla.gnome.org/show_bug.cgi?id=769206
* utils/json_from_string: Don't reset user-provided error argumentHeinrich Fink2017-03-181-1/+0
| | | | | | | | In json_from_string, just pass the user-provided GError** to json_parser_load_from_data. Otherwise json_from_string will never propagate any parser errors back to the caller. https://bugzilla.gnome.org/show_bug.cgi?id=766281
* introspection: fix nullable annotation for return values in the following ↵Alberto Ruiz2017-03-185-23/+34
| | | | | | | | | | | | | | | | | | | | | | | | methods json_builder_add_boolean_value json_builder_add_double_value json_builder_add_int_value json_builder_add_null_value json_builder_add_string_value json_builder_add_value json_builder_begin_array json_builder_begin_object json_builder_end_array json_builder_end_object json_builder_get_root json_builder_set_member_name json_generator_get_root json_reader_get_error json_reader_get_member_name json_reader_get_value json_serializable_find_property json_serializable_find_property json_boxed_serialize
* tests: Add unit for JsonReader NULL value checksEmmanuele Bassi2017-03-181-0/+28
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=758580
* reader: Make json_reader_get_value return a value for the null type. This ↵Robert Ancell2017-03-181-1/+1
| | | | | | matches the json_reader_is_value check. https://bugzilla.gnome.org/show_bug.cgi?id=758580
* docs: Fix array subsets descriptionAllin Cottrell2017-03-181-2/+2
| | | | | | | | | | | | | | | The doc for json-glib misstates the meaning of the JsonPath set notation operator, as in $.store.book[0,2] This does not mean elements 0 to 2 (a range) but rather just elements 0 and 2. This is correctly handled in the library; it's just the doc that is wrong. https://bugzilla.gnome.org/show_bug.cgi?id=768788
* docs: Use appropriate markdown for literalsEmmanuele Bassi2017-03-181-8/+8
|
* generator: Avoid multiple buffer allocationsGarrett Regier2017-03-181-187/+67
| | | | | | | Instead share a single GString in all dump functions. https://bugzilla.gnome.org/show_bug.cgi?id=773504
* parser: Use g_steal_pointer()Emmanuele Bassi2017-03-181-8/+2
| | | | | GLib already has a convenient API for stealing pointer values and replacing them with NULL, so let's use it.
* core: Add json_parser_steal_root()Ole André Vadla Ravnås2017-03-182-0/+28
| | | | | | This avoids copying the root node for the parse-to-node use-case. https://bugzilla.gnome.org/show_bug.cgi?id=774688
* core: Optimize json_from_string() to avoid copyOle André Vadla Ravnås2017-03-181-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=774688
* Add version macros for 1.4Emmanuele Bassi2017-03-181-0/+16
|
* Drop Autotools build systemEmmanuele Bassi2017-03-183-229/+0
| | | | We use Meson to build JSON-GLib, now.
* Use Unicode in translatable stringsPiotr Drąg2017-03-186-27/+27
| | | | | | See https://developer.gnome.org/hig/stable/typography.html https://bugzilla.gnome.org/show_bug.cgi?id=772753
* doc: Use 'plain' language for JSON snippetsEmmanuele Bassi2017-03-181-3/+4
|
* build: Really require the same pkg-config modulesEmmanuele Bassi2017-03-131-1/+1
|
* build: Require the same modules for Meson and AutotoolsEmmanuele Bassi2017-03-132-2/+2
| | | | We depend on gio-2.0, which strings along glib-2.0 and gobject-2.0.
* Fix the generated pkg-config file with MesonEmmanuele Bassi2017-03-131-1/+1
| | | | We need to specify the sub-directory for the inclusion directive.
* build: Add missing argument to the introspection scannerEmmanuele Bassi2017-03-131-10/+16
| | | | | | The autotools build specifies the include header with the --c-include argument for g-ir-scanner, so we need to do the same when building with Meson.
* Ensure that introspection scans all the headersEmmanuele Bassi2017-03-131-6/+6
| | | | | We have a couple of generated header files, which means we need to list them as sources for the introspection scanner.
* build: Reduce the internal dependenciesEmmanuele Bassi2017-03-131-8/+10
| | | | | | | We don't need to make internal targets depend on generated sources, just on the generated header files. Depending on the generated sources will cause Meson to compile the generated sources once for each internal target.
* Add missing header in the Meson file listingEmmanuele Bassi2017-03-131-0/+1
| | | | The single include 'json-glib.h' header is missing.
* Remove dependency on json-version.hEmmanuele Bassi2017-03-131-11/+11
| | | | The file is generated at configuration time.
* Install testsEmmanuele Bassi2017-03-132-1/+41
| | | | | | We should install our tests in order to get them executed in environments like GNOME Continuous and other continuous delivery systems.
* build: install toolsIgor Gnatenko2017-03-131-1/+1
| | | | Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>