summaryrefslogtreecommitdiff
path: root/json-glib
diff options
context:
space:
mode:
Diffstat (limited to 'json-glib')
-rw-r--r--json-glib/json-array.c13
-rw-r--r--json-glib/json-object.c13
-rw-r--r--json-glib/json-types.h4
3 files changed, 28 insertions, 2 deletions
diff --git a/json-glib/json-array.c b/json-glib/json-array.c
index 4b17825..e9727e8 100644
--- a/json-glib/json-array.c
+++ b/json-glib/json-array.c
@@ -44,6 +44,19 @@ struct _JsonArray
volatile gint ref_count;
};
+GType
+json_array_get_type (void)
+{
+ static GType array_type = 0;
+
+ if (G_UNLIKELY (!array_type))
+ array_type = g_boxed_type_register_static ("JsonArray",
+ (GBoxedCopyFunc) json_array_ref,
+ (GBoxedFreeFunc) json_array_unref);
+
+ return array_type;
+}
+
/**
* json_array_new:
*
diff --git a/json-glib/json-object.c b/json-glib/json-object.c
index 96fcdbe..bbea83d 100644
--- a/json-glib/json-object.c
+++ b/json-glib/json-object.c
@@ -47,6 +47,19 @@ struct _JsonObject
volatile gint ref_count;
};
+GType
+json_object_get_type (void)
+{
+ static GType object_type = 0;
+
+ if (G_UNLIKELY (!object_type))
+ object_type = g_boxed_type_register_static ("JsonObject",
+ (GBoxedCopyFunc) json_object_ref,
+ (GBoxedFreeFunc) json_object_unref);
+
+ return object_type;
+}
+
/**
* json_object_new:
*
diff --git a/json-glib/json-types.h b/json-glib/json-types.h
index 3278d3a..b2eb8f9 100644
--- a/json-glib/json-types.h
+++ b/json-glib/json-types.h
@@ -112,7 +112,7 @@ void json_node_get_value (JsonNode *node,
JsonNode * json_node_get_parent (JsonNode *node);
G_CONST_RETURN gchar *json_node_type_name (JsonNode *node);
-void json_object_get_type (void) G_GNUC_CONST;
+GType json_object_get_type (void) G_GNUC_CONST;
JsonObject * json_object_new (void);
JsonObject * json_object_ref (JsonObject *object);
void json_object_unref (JsonObject *object);
@@ -126,7 +126,7 @@ gboolean json_object_has_member (JsonObject *object,
const gchar *member_name);
guint json_object_get_size (JsonObject *object);
-void json_array_get_type (void) G_GNUC_CONST;
+GType json_array_get_type (void) G_GNUC_CONST;
JsonArray * json_array_new (void);
JsonArray * json_array_sized_new (guint n_elements);
JsonArray * json_array_ref (JsonArray *array);