]> Git Repo - qemu.git/blobdiff - migration/qjson.c
blockjob: Wake up BDS when job becomes idle
[qemu.git] / migration / qjson.c
index cb479fe0eb66974b36d1556b92cd19338253cc19..e9889bdcb0dfdd476489b6d778973a155282f017 100644 (file)
 
 #include "qemu/osdep.h"
 #include "qapi/qmp/qstring.h"
-#include "migration/qjson.h"
-#include "qemu/module.h"
-#include "qom/object.h"
+#include "qjson.h"
 
 struct QJSON {
-    Object obj;
     QString *str;
     bool omit_comma;
 };
 
-#define QJSON(obj) OBJECT_CHECK(QJSON, (obj), TYPE_QJSON)
-
 static void json_emit_element(QJSON *json, const char *name)
 {
     /* Check whether we need to print a , before an element */
@@ -100,41 +95,20 @@ const char *qjson_get_str(QJSON *json)
 
 QJSON *qjson_new(void)
 {
-    QJSON *json = QJSON(object_new(TYPE_QJSON));
-    return json;
-}
-
-void qjson_finish(QJSON *json)
-{
-    json_end_object(json);
-}
-
-static void qjson_initfn(Object *obj)
-{
-    QJSON *json = QJSON(obj);
+    QJSON *json = g_new0(QJSON, 1);
 
     json->str = qstring_from_str("{ ");
     json->omit_comma = true;
+    return json;
 }
 
-static void qjson_finalizefn(Object *obj)
+void qjson_finish(QJSON *json)
 {
-    QJSON *json = QJSON(obj);
-
-    qobject_decref(QOBJECT(json->str));
+    json_end_object(json);
 }
 
-static const TypeInfo qjson_type_info = {
-    .name = TYPE_QJSON,
-    .parent = TYPE_OBJECT,
-    .instance_size = sizeof(QJSON),
-    .instance_init = qjson_initfn,
-    .instance_finalize = qjson_finalizefn,
-};
-
-static void qjson_register_types(void)
+void qjson_destroy(QJSON *json)
 {
-    type_register_static(&qjson_type_info);
+    qobject_unref(json->str);
+    g_free(json);
 }
-
-type_init(qjson_register_types)
This page took 0.024815 seconds and 4 git commands to generate.