[json-glib] Use G_DEFINE_QUARK macro
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] Use G_DEFINE_QUARK macro
- Date: Thu, 16 May 2013 10:05:18 +0000 (UTC)
commit c912213d05ea9cacb5ba87f25c76581737c6fbf6
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu May 16 10:02:50 2013 +0100
Use G_DEFINE_QUARK macro
Instead of hand-writing the error domain function ourselves.
json-glib/json-parser.c | 10 +++-------
json-glib/json-path.c | 8 ++------
json-glib/json-reader.c | 10 +++-------
3 files changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index f9722bd..593258c 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -45,12 +45,6 @@
#include "json-parser.h"
#include "json-scanner.h"
-GQuark
-json_parser_error_quark (void)
-{
- return g_quark_from_static_string ("json-parser-error");
-}
-
#define JSON_PARSER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), JSON_TYPE_PARSER,
JsonParserPrivate))
struct _JsonParserPrivate
@@ -106,7 +100,9 @@ enum
static guint parser_signals[LAST_SIGNAL] = { 0, };
-G_DEFINE_TYPE (JsonParser, json_parser, G_TYPE_OBJECT);
+G_DEFINE_QUARK (json-parser-error-quark, json_parser_error)
+
+G_DEFINE_TYPE (JsonParser, json_parser, G_TYPE_OBJECT)
static guint json_parse_array (JsonParser *parser,
JsonScanner *scanner,
diff --git a/json-glib/json-path.c b/json-glib/json-path.c
index 4fb61bc..56a6858 100644
--- a/json-glib/json-path.c
+++ b/json-glib/json-path.c
@@ -260,6 +260,8 @@ struct _PathNode
} data;
};
+G_DEFINE_QUARK (json-path-error-quark, json_path_error)
+
G_DEFINE_TYPE (JsonPath, json_path, G_TYPE_OBJECT)
static void
@@ -308,12 +310,6 @@ json_path_init (JsonPath *self)
{
}
-GQuark
-json_path_error_quark (void)
-{
- return g_quark_from_static_string ("json-path-error");
-}
-
/**
* json_path_new:
*
diff --git a/json-glib/json-reader.c b/json-glib/json-reader.c
index 721f069..b2a9f7f 100644
--- a/json-glib/json-reader.c
+++ b/json-glib/json-reader.c
@@ -109,7 +109,9 @@ enum
static GParamSpec *reader_properties[PROP_LAST] = { NULL, };
-G_DEFINE_TYPE (JsonReader, json_reader, G_TYPE_OBJECT);
+G_DEFINE_TYPE (JsonReader, json_reader, G_TYPE_OBJECT)
+
+G_DEFINE_QUARK (json-reader-error-quark, json_reader_error)
static void
json_reader_finalize (GObject *gobject)
@@ -199,12 +201,6 @@ json_reader_init (JsonReader *self)
JsonReaderPrivate);
}
-GQuark
-json_reader_error_quark (void)
-{
- return g_quark_from_static_string ("json-reader-error");
-}
-
/**
* json_reader_new:
* @node: (allow-none): a #JsonNode, or %NULL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]