[PATCH libvirt-glib 5/6] Use G_DEFINE_BOXED_TYPE for boxed types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 libvirt-gobject/libvirt-gobject-connection.c       |   26 ++++++-------
 libvirt-gobject/libvirt-gobject-domain-disk.c      |   15 +------
 libvirt-gobject/libvirt-gobject-domain-interface.c |   15 +------
 libvirt-gobject/libvirt-gobject-domain-snapshot.c  |   25 +++++-------
 libvirt-gobject/libvirt-gobject-domain.c           |   40 +++++++-------------
 libvirt-gobject/libvirt-gobject-interface.c        |   24 +++++-------
 libvirt-gobject/libvirt-gobject-network-filter.c   |   25 +++++-------
 libvirt-gobject/libvirt-gobject-network.c          |   25 +++++-------
 libvirt-gobject/libvirt-gobject-node-device.c      |   25 +++++-------
 libvirt-gobject/libvirt-gobject-secret.c           |   25 +++++-------
 libvirt-gobject/libvirt-gobject-storage-pool.c     |   25 +++++-------
 libvirt-gobject/libvirt-gobject-storage-vol.c      |   25 +++++-------
 libvirt-gobject/libvirt-gobject-stream.c           |   25 +++++-------
 13 files changed, 130 insertions(+), 190 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index ec3f7c3..0f6e530 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -1121,27 +1122,24 @@ GVirStoragePool *gvir_connection_find_storage_pool_by_name(GVirConnection *conn,
     return NULL;
 }
 
-static gpointer
-gvir_connection_handle_copy(gpointer src)
+typedef struct virConnect GVirConnectionHandle;
+
+static GVirConnectionHandle*
+gvir_connection_handle_copy(GVirConnectionHandle *src)
 {
-    virConnectRef(src);
+    virConnectRef((virConnectPtr)src);
     return src;
 }
 
-
-GType gvir_connection_handle_get_type(void)
+static void
+gvir_connection_handle_free(GVirConnectionHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirConnectionHandle",
-             gvir_connection_handle_copy,
-             (GBoxedFreeFunc)virConnectClose);
-
-    return handle_type;
+    virConnectClose((virConnectPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirConnectionHandle, gvir_connection_handle,
+                    gvir_connection_handle_copy, gvir_connection_handle_free)
+
 /**
  * gvir_connection_get_stream:
  * @flags: flags to use for the stream
diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
index fcb2596..b8f9dbb 100644
--- a/libvirt-gobject/libvirt-gobject-domain-disk.c
+++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
@@ -27,6 +27,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 #include "libvirt-gobject/libvirt-gobject-domain-device-private.h"
 
@@ -151,18 +152,8 @@ gvir_domain_disk_stats_free(GVirDomainDiskStats *stats)
 }
 
 
-GType gvir_domain_disk_stats_get_type(void)
-{
-    static GType stats_type = 0;
-
-    if (G_UNLIKELY(stats_type == 0))
-        stats_type = g_boxed_type_register_static
-            ("GVirDomainDiskStats",
-             (GBoxedCopyFunc)gvir_domain_disk_stats_copy,
-             (GBoxedFreeFunc)gvir_domain_disk_stats_free);
-
-    return stats_type;
-}
+G_DEFINE_BOXED_TYPE(GVirDomainDiskStats, gvir_domain_disk_stats,
+                    gvir_domain_disk_stats_copy, gvir_domain_disk_stats_free)
 
 /**
  * gvir_domain_disk_get_stats:
diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index 83f24c7..a6720c8 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
@@ -27,6 +27,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 #include "libvirt-gobject/libvirt-gobject-domain-device-private.h"
 
@@ -151,18 +152,8 @@ gvir_domain_interface_stats_free(GVirDomainInterfaceStats *stats)
 }
 
 
-GType gvir_domain_interface_stats_get_type(void)
-{
-    static GType stats_type = 0;
-
-    if (G_UNLIKELY(stats_type == 0))
-        stats_type = g_boxed_type_register_static
-            ("GVirDomainInterfaceStats",
-             (GBoxedCopyFunc)gvir_domain_interface_stats_copy,
-             (GBoxedFreeFunc)gvir_domain_interface_stats_free);
-
-    return stats_type;
-}
+G_DEFINE_BOXED_TYPE(GVirDomainInterfaceStats, gvir_domain_interface_stats,
+                    gvir_domain_interface_stats_copy, gvir_domain_interface_stats_free)
 
 /**
  * gvir_domain_interface_get_stats:
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index 530907d..96be997 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -148,29 +149,25 @@ static void gvir_domain_snapshot_init(GVirDomainSnapshot *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_domain_snapshot_handle_copy(gpointer src)
+typedef struct virDomainSnapshot GVirDomainSnapshotHandle;
+
+static GVirDomainSnapshotHandle*
+gvir_domain_snapshot_handle_copy(GVirDomainSnapshotHandle *src)
 {
 #if 0
-    virDomainSnapshotRef(src);
+    virDomainSnapshotRef((virDomainSnapshotPtr)src);
 #endif
     return src;
 }
 
-
-GType gvir_domain_snapshot_handle_get_type(void)
+static void
+gvir_domain_snapshot_handle_free(GVirDomainSnapshotHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirDomainSnapshotHandle",
-             gvir_domain_snapshot_handle_copy,
-             (GBoxedFreeFunc)virDomainSnapshotFree);
-
-    return handle_type;
+    virDomainSnapshotFree((virDomainSnapshotPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirDomainSnapshotHandle, gvir_domain_snapshot_handle,
+                    gvir_domain_snapshot_handle_copy, gvir_domain_snapshot_handle_free)
 
 const gchar *gvir_domain_snapshot_get_name(GVirDomainSnapshot *snapshot)
 {
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 2932f8c..1fa27bd 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -223,27 +224,24 @@ static void gvir_domain_init(GVirDomain *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_domain_handle_copy(gpointer src)
+typedef struct virDomain GVirDomainHandle;
+
+static GVirDomainHandle*
+gvir_domain_handle_copy(GVirDomainHandle *src)
 {
-    virDomainRef(src);
+    virDomainRef((virDomainPtr)src);
     return src;
 }
 
-
-GType gvir_domain_handle_get_type(void)
+static void
+gvir_domain_handle_free(GVirDomainHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirDomainHandle",
-             gvir_domain_handle_copy,
-             (GBoxedFreeFunc)virDomainFree);
-
-    return handle_type;
+    virDomainFree((virDomainPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirDomainHandle, gvir_domain_handle,
+                    gvir_domain_handle_copy, gvir_domain_handle_free)
+
 static GVirDomainInfo *
 gvir_domain_info_copy(GVirDomainInfo *info)
 {
@@ -258,18 +256,8 @@ gvir_domain_info_free(GVirDomainInfo *info)
 }
 
 
-GType gvir_domain_info_get_type(void)
-{
-    static GType info_type = 0;
-
-    if (G_UNLIKELY(info_type == 0))
-        info_type = g_boxed_type_register_static
-            ("GVirDomainInfo",
-             (GBoxedCopyFunc)gvir_domain_info_copy,
-             (GBoxedFreeFunc)gvir_domain_info_free);
-
-    return info_type;
-}
+G_DEFINE_BOXED_TYPE(GVirDomainInfo, gvir_domain_info,
+                    gvir_domain_info_copy, gvir_domain_info_free)
 
 
 const gchar *gvir_domain_get_name(GVirDomain *dom)
diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
index 2c56492..f74b47c 100644
--- a/libvirt-gobject/libvirt-gobject-interface.c
+++ b/libvirt-gobject/libvirt-gobject-interface.c
@@ -148,27 +148,23 @@ static void gvir_interface_init(GVirInterface *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_interface_handle_copy(gpointer src)
+typedef struct virInterface GVirInterfaceHandle;
+
+static GVirInterfaceHandle*
+gvir_interface_handle_copy(GVirInterfaceHandle *src)
 {
-    virInterfaceRef(src);
+    virInterfaceRef((virInterfacePtr)src);
     return src;
 }
 
-
-GType gvir_interface_handle_get_type(void)
+static void
+gvir_interface_handle_free(GVirInterfaceHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirInterfaceHandle",
-             gvir_interface_handle_copy,
-             (GBoxedFreeFunc)virInterfaceFree);
-
-    return handle_type;
+    virInterfaceFree((virInterfacePtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirInterfaceHandle, gvir_interface_handle,
+                    gvir_interface_handle_copy, gvir_interface_handle_free)
 
 const gchar *gvir_interface_get_name(GVirInterface *iface)
 {
diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
index b043e42..b5ffbe7 100644
--- a/libvirt-gobject/libvirt-gobject-network-filter.c
+++ b/libvirt-gobject/libvirt-gobject-network-filter.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -164,27 +165,23 @@ static void gvir_network_filter_init(GVirNetworkFilter *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_network_filter_handle_copy(gpointer src)
+typedef struct virNWFilter GVirNetworkFilterHandle;
+
+static GVirNetworkFilterHandle*
+gvir_network_filter_handle_copy(GVirNetworkFilterHandle *src)
 {
-    virNWFilterRef(src);
+    virNWFilterRef((virNWFilterPtr)src);
     return src;
 }
 
-
-GType gvir_network_filter_handle_get_type(void)
+static void
+gvir_network_filter_handle_free(GVirNetworkFilterHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirNetworkFilterHandle",
-             gvir_network_filter_handle_copy,
-             (GBoxedFreeFunc)virNWFilterFree);
-
-    return handle_type;
+    virNWFilterFree((virNWFilterPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirNetworkFilterHandle, gvir_network_filter_handle,
+                    gvir_network_filter_handle_copy, gvir_network_filter_handle_free)
 
 const gchar *gvir_network_filter_get_name(GVirNetworkFilter *filter)
 {
diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
index 34692fd..20b8012 100644
--- a/libvirt-gobject/libvirt-gobject-network.c
+++ b/libvirt-gobject/libvirt-gobject-network.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -162,27 +163,23 @@ static void gvir_network_init(GVirNetwork *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_network_handle_copy(gpointer src)
+typedef struct virNetwork GVirNetworkHandle;
+
+static GVirNetworkHandle*
+gvir_network_handle_copy(GVirNetworkHandle *src)
 {
-    virNetworkRef(src);
+    virNetworkRef((virNetworkPtr)src);
     return src;
 }
 
-
-GType gvir_network_handle_get_type(void)
+static void
+gvir_network_handle_free(GVirNetworkHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirNetworkHandle",
-             gvir_network_handle_copy,
-             (GBoxedFreeFunc)virNetworkFree);
-
-    return handle_type;
+    virNetworkFree((virNetworkPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirNetworkHandle, gvir_network_handle,
+                    gvir_network_handle_copy, gvir_network_handle_free)
 
 const gchar *gvir_network_get_name(GVirNetwork *network)
 {
diff --git a/libvirt-gobject/libvirt-gobject-node-device.c b/libvirt-gobject/libvirt-gobject-node-device.c
index b3ae6bf..784c594 100644
--- a/libvirt-gobject/libvirt-gobject-node-device.c
+++ b/libvirt-gobject/libvirt-gobject-node-device.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -148,27 +149,23 @@ static void gvir_node_device_init(GVirNodeDevice *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_node_device_handle_copy(gpointer src)
+typedef struct virNodeDevice GVirNodeDeviceHandle;
+
+static GVirNodeDeviceHandle*
+gvir_node_device_handle_copy(GVirNodeDeviceHandle *src)
 {
-    virNodeDeviceRef(src);
+    virNodeDeviceRef((virNodeDevicePtr)src);
     return src;
 }
 
-
-GType gvir_node_device_handle_get_type(void)
+static void
+gvir_node_device_handle_free(GVirNodeDeviceHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirNodeDeviceHandle",
-             gvir_node_device_handle_copy,
-             (GBoxedFreeFunc)virNodeDeviceFree);
-
-    return handle_type;
+    virNodeDeviceFree((virNodeDevicePtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirNodeDeviceHandle, gvir_node_device_handle,
+                    gvir_node_device_handle_copy, gvir_node_device_handle_free)
 
 const gchar *gvir_node_device_get_name(GVirNodeDevice *device)
 {
diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
index b39bac5..0f885a1 100644
--- a/libvirt-gobject/libvirt-gobject-secret.c
+++ b/libvirt-gobject/libvirt-gobject-secret.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -164,27 +165,23 @@ static void gvir_secret_init(GVirSecret *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_secret_handle_copy(gpointer src)
+typedef struct virSecret GVirSecretHandle;
+
+static GVirSecretHandle*
+gvir_secret_handle_copy(GVirSecretHandle *src)
 {
-    virSecretRef(src);
+    virSecretRef((virSecretPtr)src);
     return src;
 }
 
-
-GType gvir_secret_handle_get_type(void)
+static void
+gvir_secret_handle_free(GVirSecretHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirSecretHandle",
-             gvir_secret_handle_copy,
-             (GBoxedFreeFunc)virSecretFree);
-
-    return handle_type;
+    virSecretFree((virSecretPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirSecretHandle, gvir_secret_handle,
+                    gvir_secret_handle_copy, gvir_secret_handle_free)
 
 const gchar *gvir_secret_get_uuid(GVirSecret *secret)
 {
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index 33010f1..ccc8e8a 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -176,27 +177,23 @@ static void gvir_storage_pool_init(GVirStoragePool *pool)
     priv->lock = g_mutex_new();
 }
 
-static gpointer
-gvir_storage_pool_handle_copy(gpointer src)
+typedef struct virStoragePool GVirStoragePoolHandle;
+
+static GVirStoragePoolHandle*
+gvir_storage_pool_handle_copy(GVirStoragePoolHandle *src)
 {
-    virStoragePoolRef(src);
+    virStoragePoolRef((virStoragePoolPtr)src);
     return src;
 }
 
-
-GType gvir_storage_pool_handle_get_type(void)
+static void
+gvir_storage_pool_handle_free(GVirStoragePoolHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirStoragePoolHandle",
-             gvir_storage_pool_handle_copy,
-             (GBoxedFreeFunc)virStoragePoolFree);
-
-    return handle_type;
+    virStoragePoolFree((virStoragePoolPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirStoragePoolHandle, gvir_storage_pool_handle,
+                    gvir_storage_pool_handle_copy, gvir_storage_pool_handle_free)
 
 const gchar *gvir_storage_pool_get_name(GVirStoragePool *pool)
 {
diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
index 0d94cd5..ed48de8 100644
--- a/libvirt-gobject/libvirt-gobject-storage-vol.c
+++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
@@ -28,6 +28,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 extern gboolean debugFlag;
 
@@ -148,27 +149,23 @@ static void gvir_storage_vol_init(GVirStorageVol *conn)
     memset(priv, 0, sizeof(*priv));
 }
 
-static gpointer
-gvir_storage_vol_handle_copy(gpointer src)
+typedef struct virStorageVol GVirStorageVolHandle;
+
+static GVirStorageVolHandle*
+gvir_storage_vol_handle_copy(GVirStorageVolHandle *src)
 {
-    virStorageVolRef(src);
+    virStorageVolRef((virStorageVolPtr)src);
     return src;
 }
 
-
-GType gvir_storage_vol_handle_get_type(void)
+static void
+gvir_storage_vol_handle_free(GVirStorageVolHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirStorageVolHandle",
-             gvir_storage_vol_handle_copy,
-             (GBoxedFreeFunc)virStorageVolFree);
-
-    return handle_type;
+    virStorageVolFree((virStorageVolPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirStorageVolHandle, gvir_storage_vol_handle,
+                    gvir_storage_vol_handle_copy, gvir_storage_vol_handle_free)
 
 const gchar *gvir_storage_vol_get_name(GVirStorageVol *vol)
 {
diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
index 05d338f..30673aa 100644
--- a/libvirt-gobject/libvirt-gobject-stream.c
+++ b/libvirt-gobject/libvirt-gobject-stream.c
@@ -29,6 +29,7 @@
 
 #include "libvirt-glib/libvirt-glib.h"
 #include "libvirt-gobject/libvirt-gobject.h"
+#include "libvirt-gobject-compat.h"
 
 #include "libvirt-gobject/libvirt-gobject-input-stream.h"
 
@@ -226,28 +227,24 @@ static void gvir_stream_init(GVirStream *self)
     self->priv = GVIR_STREAM_GET_PRIVATE(self);
 }
 
+typedef struct virStream GVirStreamHandle;
 
-static gpointer
-gvir_stream_handle_copy(gpointer src)
+static GVirStreamHandle*
+gvir_stream_handle_copy(GVirStreamHandle *src)
 {
-    virStreamRef(src);
+    virStreamRef((virStreamPtr)src);
     return src;
 }
 
-
-GType gvir_stream_handle_get_type(void)
+static void
+gvir_stream_handle_free(GVirStreamHandle *src)
 {
-    static GType handle_type = 0;
-
-    if (G_UNLIKELY(handle_type == 0))
-        handle_type = g_boxed_type_register_static
-            ("GVirStreamHandle",
-             gvir_stream_handle_copy,
-             (GBoxedFreeFunc)virStreamFree);
-
-    return handle_type;
+    virStreamFree((virStreamPtr)src);
 }
 
+G_DEFINE_BOXED_TYPE(GVirStreamHandle, gvir_stream_handle,
+                    gvir_stream_handle_copy, gvir_stream_handle_free)
+
 /**
  * gvir_stream_receive:
  * @stream: the stream
-- 
1.7.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]