mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
format: Drop dependency on json-c
json-c has a symbol clash (json_object_get_type) with json-glib (which at least a number of our GNOME clients use). This patch moves to our own JSON parser so that we can avoid this kind of situation altogether. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135 Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
This commit is contained in:
parent
6741e5ae76
commit
c692ec3afd
6 changed files with 187 additions and 143 deletions
|
|
@ -26,8 +26,6 @@
|
|||
#include <pulse/json.h>
|
||||
#include <pulsecore/core-util.h>
|
||||
|
||||
#define IS_EQUAL(x, y) (((x) - (y)) < 0.000001 && ((x) - (y)) > -0.000001)
|
||||
|
||||
START_TEST (string_test) {
|
||||
pa_json_object *o;
|
||||
unsigned int i;
|
||||
|
|
@ -85,7 +83,7 @@ START_TEST(double_test) {
|
|||
|
||||
fail_unless(o != NULL);
|
||||
fail_unless(pa_json_object_get_type(o) == PA_JSON_TYPE_DOUBLE);
|
||||
fail_unless(IS_EQUAL(pa_json_object_get_double(o), doubles_compare[i]));
|
||||
fail_unless(PA_DOUBLE_IS_EQUAL(pa_json_object_get_double(o), doubles_compare[i]));
|
||||
|
||||
pa_json_object_unref(o);
|
||||
}
|
||||
|
|
@ -149,7 +147,7 @@ START_TEST(object_test) {
|
|||
v = pa_json_object_get_object_member(o, "age");
|
||||
fail_unless(v != NULL);
|
||||
fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_DOUBLE);
|
||||
fail_unless(IS_EQUAL(pa_json_object_get_double(v), -45.3));
|
||||
fail_unless(PA_DOUBLE_IS_EQUAL(pa_json_object_get_double(v), -45.3));
|
||||
|
||||
pa_json_object_unref(o);
|
||||
|
||||
|
|
@ -205,7 +203,7 @@ START_TEST(array_test) {
|
|||
v = pa_json_object_get_array_member(o, 1);
|
||||
fail_unless(v != NULL);
|
||||
fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_DOUBLE);
|
||||
fail_unless(IS_EQUAL(pa_json_object_get_double(v), 1234.5));
|
||||
fail_unless(PA_DOUBLE_IS_EQUAL(pa_json_object_get_double(v), 1234.5));
|
||||
v = pa_json_object_get_array_member(o, 2);
|
||||
fail_unless(v != NULL);
|
||||
fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_OBJECT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue