[json-glib] Remove compile time GLib version check
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] Remove compile time GLib version check
- Date: Thu, 22 Aug 2013 10:11:22 +0000 (UTC)
commit 5b6ada6b362f3ff160608c00bcffbb8f2b8eff7b
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Aug 21 12:16:10 2013 +0100
Remove compile time GLib version check
We depend on a new version of GLib, so we can remove a bunch of old
version checks.
json-glib/json-builder.c | 14 +-------------
json-glib/json-generator.c | 14 +-------------
json-glib/json-gobject.c | 8 --------
json-glib/json-parser.c | 14 +-------------
json-glib/json-reader.c | 13 -------------
json-glib/tests/array.c | 4 ----
json-glib/tests/boxed.c | 3 ---
json-glib/tests/builder.c | 3 ---
json-glib/tests/generator.c | 3 ---
json-glib/tests/gvariant.c | 3 ---
json-glib/tests/invalid.c | 3 ---
json-glib/tests/node.c | 3 ---
json-glib/tests/object.c | 3 ---
json-glib/tests/parser.c | 3 ---
json-glib/tests/path.c | 3 ---
json-glib/tests/reader.c | 3 ---
json-glib/tests/serialize-complex.c | 3 ---
json-glib/tests/serialize-full.c | 3 ---
json-glib/tests/serialize-simple.c | 3 ---
19 files changed, 3 insertions(+), 103 deletions(-)
---
diff --git a/json-glib/json-builder.c b/json-glib/json-builder.c
index 82e3ec7..90d6e2c 100644
--- a/json-glib/json-builder.c
+++ b/json-glib/json-builder.c
@@ -48,11 +48,7 @@
#include "json-builder.h"
-#if GLIB_CHECK_VERSION (2, 37, 3)
-# define JSON_BUILDER_GET_PRIVATE(obj) ((JsonBuilderPrivate *) json_builder_get_instance_private
((JsonBuilder *) (obj)))
-#else
-# define JSON_BUILDER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), JSON_TYPE_BUILDER,
JsonBuilderPrivate))
-#endif
+#define JSON_BUILDER_GET_PRIVATE(obj) ((JsonBuilderPrivate *) json_builder_get_instance_private
((JsonBuilder *) (obj)))
struct _JsonBuilderPrivate
{
@@ -107,11 +103,7 @@ json_builder_state_free (JsonBuilderState *state)
}
}
-#if GLIB_CHECK_VERSION (2, 37, 3)
G_DEFINE_TYPE_WITH_PRIVATE (JsonBuilder, json_builder, G_TYPE_OBJECT)
-#else
-G_DEFINE_TYPE (JsonBuilder, json_builder, G_TYPE_OBJECT)
-#endif
static void
json_builder_free_all_state (JsonBuilder *builder)
@@ -149,10 +141,6 @@ json_builder_class_init (JsonBuilderClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-#if !GLIB_CHECK_VERSION (2, 37, 3)
- g_type_class_add_private (klass, sizeof (JsonBuilderPrivate));
-#endif
-
gobject_class->finalize = json_builder_finalize;
}
diff --git a/json-glib/json-generator.c b/json-glib/json-generator.c
index 04beaf4..8621b02 100644
--- a/json-glib/json-generator.c
+++ b/json-glib/json-generator.c
@@ -41,11 +41,7 @@
#include "json-marshal.h"
#include "json-generator.h"
-#if GLIB_CHECK_VERSION (2, 37, 3)
-# define JSON_GENERATOR_GET_PRIVATE(obj) ((JsonGeneratorPrivate *) json_generator_get_instance_private
((JsonGenerator *) (obj)))
-#else
-# define JSON_GENERATOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), JSON_TYPE_GENERATOR,
JsonGeneratorPrivate))
-#endif
+#define JSON_GENERATOR_GET_PRIVATE(obj) ((JsonGeneratorPrivate *) json_generator_get_instance_private
((JsonGenerator *) (obj)))
struct _JsonGeneratorPrivate
{
@@ -112,11 +108,7 @@ static const char json_exceptions[] = {
static GParamSpec *generator_props[PROP_LAST] = { NULL, };
-#if GLIB_CHECK_VERSION (2, 37, 3)
G_DEFINE_TYPE_WITH_PRIVATE (JsonGenerator, json_generator, G_TYPE_OBJECT)
-#else
-G_DEFINE_TYPE (JsonGenerator, json_generator, G_TYPE_OBJECT)
-#endif
static gchar *
json_strescape (const gchar *str)
@@ -200,10 +192,6 @@ json_generator_class_init (JsonGeneratorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-#if !GLIB_CHECK_VERSION (2, 37, 3)
- g_type_class_add_private (klass, sizeof (JsonGeneratorPrivate));
-#endif
-
/**
* JsonGenerator:pretty:
*
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index b2c86d6..8b89fb5 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -534,11 +534,7 @@ json_deserialize_pspec (GValue *value,
case G_TYPE_CHAR:
if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
{
-#if GLIB_CHECK_VERSION (2, 31, 0)
g_value_set_schar (value, (gchar) g_value_get_int64 (&node_value));
-#else
- g_value_set_char (value, (gchar) g_value_get_int64 (&node_value));
-#endif
retval = TRUE;
}
break;
@@ -707,11 +703,7 @@ json_serialize_pspec (const GValue *real_value,
case G_TYPE_CHAR:
retval = json_node_alloc ();
-#if GLIB_CHECK_VERSION (2, 31, 0)
json_node_init_int (retval, g_value_get_schar (real_value));
-#else
- json_node_init_int (retval, g_value_get_char (real_value));
-#endif
break;
case G_TYPE_UCHAR:
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 1600e90..fc22eb1 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -45,11 +45,7 @@
#include "json-parser.h"
#include "json-scanner.h"
-#if GLIB_CHECK_VERSION (2, 37, 3)
-# define JSON_PARSER_GET_PRIVATE(obj) ((JsonParserPrivate *) json_parser_get_instance_private ((JsonParser
*) (obj)))
-#else
-# define JSON_PARSER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), JSON_TYPE_PARSER,
JsonParserPrivate))
-#endif
+#define JSON_PARSER_GET_PRIVATE(obj) ((JsonParserPrivate *) json_parser_get_instance_private ((JsonParser *)
(obj)))
struct _JsonParserPrivate
{
@@ -106,11 +102,7 @@ static guint parser_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_QUARK (json-parser-error-quark, json_parser_error)
-#if GLIB_CHECK_VERSION (2, 37, 3)
G_DEFINE_TYPE_WITH_PRIVATE (JsonParser, json_parser, G_TYPE_OBJECT)
-#else
-G_DEFINE_TYPE (JsonParser, json_parser, G_TYPE_OBJECT)
-#endif
static guint json_parse_array (JsonParser *parser,
JsonScanner *scanner,
@@ -164,10 +156,6 @@ json_parser_class_init (JsonParserClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-#if !GLIB_CHECK_VERSION (2, 37, 3)
- g_type_class_add_private (klass, sizeof (JsonParserPrivate));
-#endif
-
gobject_class->dispose = json_parser_dispose;
gobject_class->finalize = json_parser_finalize;
diff --git a/json-glib/json-reader.c b/json-glib/json-reader.c
index 6b7751f..667ba40 100644
--- a/json-glib/json-reader.c
+++ b/json-glib/json-reader.c
@@ -109,11 +109,7 @@ enum
static GParamSpec *reader_properties[PROP_LAST] = { NULL, };
-#if GLIB_CHECK_VERSION (2, 37, 3)
G_DEFINE_TYPE_WITH_PRIVATE (JsonReader, json_reader, G_TYPE_OBJECT)
-#else
-G_DEFINE_TYPE (JsonReader, json_reader, G_TYPE_OBJECT)
-#endif
G_DEFINE_QUARK (json-reader-error-quark, json_reader_error)
@@ -174,10 +170,6 @@ json_reader_class_init (JsonReaderClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-#if !GLIB_CHECK_VERSION (2, 37, 3)
- g_type_class_add_private (klass, sizeof (JsonReaderPrivate));
-#endif
-
/**
* JsonReader:root:
*
@@ -203,12 +195,7 @@ json_reader_class_init (JsonReaderClass *klass)
static void
json_reader_init (JsonReader *self)
{
-#if GLIB_CHECK_VERSION (2, 37, 3)
self->priv = json_reader_get_instance_private (self);
-#else
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, JSON_TYPE_READER,
- JsonReaderPrivate);
-#endif
}
/**
diff --git a/json-glib/tests/array.c b/json-glib/tests/array.c
index 115e84a..98afeab 100644
--- a/json-glib/tests/array.c
+++ b/json-glib/tests/array.c
@@ -144,10 +144,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
-
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/array/empty-array", test_empty_array);
diff --git a/json-glib/tests/boxed.c b/json-glib/tests/boxed.c
index 5e0fb01..6e52e2a 100644
--- a/json-glib/tests/boxed.c
+++ b/json-glib/tests/boxed.c
@@ -254,9 +254,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/boxed/serialize-property", test_serialize_boxed);
diff --git a/json-glib/tests/builder.c b/json-glib/tests/builder.c
index 06a4c42..0183381 100644
--- a/json-glib/tests/builder.c
+++ b/json-glib/tests/builder.c
@@ -157,9 +157,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/builder/complex", test_builder_complex);
diff --git a/json-glib/tests/generator.c b/json-glib/tests/generator.c
index 40ceb55..136795d 100644
--- a/json-glib/tests/generator.c
+++ b/json-glib/tests/generator.c
@@ -381,9 +381,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/generator/empty-array", test_empty_array);
diff --git a/json-glib/tests/gvariant.c b/json-glib/tests/gvariant.c
index c8eb143..acb7f69 100644
--- a/json-glib/tests/gvariant.c
+++ b/json-glib/tests/gvariant.c
@@ -204,9 +204,6 @@ main (gint argc, gchar *argv[])
TestCase test_case;
gchar *test_name;
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
/* GVariant to JSON */
diff --git a/json-glib/tests/invalid.c b/json-glib/tests/invalid.c
index ad8e613..5eff885 100644
--- a/json-glib/tests/invalid.c
+++ b/json-glib/tests/invalid.c
@@ -221,9 +221,6 @@ main (int argc,
{
int i;
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_test_invalid; i++)
diff --git a/json-glib/tests/node.c b/json-glib/tests/node.c
index 1782c8e..6aad5bc 100644
--- a/json-glib/tests/node.c
+++ b/json-glib/tests/node.c
@@ -246,9 +246,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/nodes/init/int", test_init_int);
diff --git a/json-glib/tests/object.c b/json-glib/tests/object.c
index 750ab88..f109464 100644
--- a/json-glib/tests/object.c
+++ b/json-glib/tests/object.c
@@ -166,9 +166,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/object/empty-object", test_empty_object);
diff --git a/json-glib/tests/parser.c b/json-glib/tests/parser.c
index 948d18e..3566217 100644
--- a/json-glib/tests/parser.c
+++ b/json-glib/tests/parser.c
@@ -745,9 +745,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/parser/empty-string", test_empty);
diff --git a/json-glib/tests/path.c b/json-glib/tests/path.c
index bac8ae0..23268d5 100644
--- a/json-glib/tests/path.c
+++ b/json-glib/tests/path.c
@@ -245,9 +245,6 @@ main (int argc,
{
int i, j;
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");
diff --git a/json-glib/tests/reader.c b/json-glib/tests/reader.c
index 2ed90d6..2b75522 100644
--- a/json-glib/tests/reader.c
+++ b/json-glib/tests/reader.c
@@ -137,9 +137,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=");
diff --git a/json-glib/tests/serialize-complex.c b/json-glib/tests/serialize-complex.c
index 7b26da5..9da8dd1 100644
--- a/json-glib/tests/serialize-complex.c
+++ b/json-glib/tests/serialize-complex.c
@@ -301,9 +301,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/serialize/gobject-boxed", test_serialize);
diff --git a/json-glib/tests/serialize-full.c b/json-glib/tests/serialize-full.c
index 88388ef..dd5da7a 100644
--- a/json-glib/tests/serialize-full.c
+++ b/json-glib/tests/serialize-full.c
@@ -446,9 +446,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/deserialize/json-to-gobject", test_deserialize);
diff --git a/json-glib/tests/serialize-simple.c b/json-glib/tests/serialize-simple.c
index 89611f7..e2e7be2 100644
--- a/json-glib/tests/serialize-simple.c
+++ b/json-glib/tests/serialize-simple.c
@@ -157,9 +157,6 @@ int
main (int argc,
char *argv[])
{
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- g_type_init ();
-#endif
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/serialize/gobject", test_serialize);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]