]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: convert virIdentity class to use GObject
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 19 Sep 2019 14:38:03 +0000 (15:38 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 14 Oct 2019 09:54:42 +0000 (10:54 +0100)
commit16121a88a7ef933220bcf9eff6575367278a06f7
tree3978e36232bc41c5e72e5418a881627d7bad1475
parentb74a95d6a2950a7b9168d772b49e07a5d20a3f63
util: convert virIdentity class to use GObject

Converting from virObject to GObject is reasonably straightforward,
as illustrated by this patch for virIdentity

In the header file

 - Remove

     typedef struct _virIdentity virIdentity

 - Add

     #define VIR_TYPE_IDENTITY virIdentity_get_type ()
     G_DECLARE_FINAL_TYPE (virIdentity, vir_identity, VIR, IDENTITY, GObject);

   Which provides the typedef we just removed, and class
   declaration boilerplate and various other constants/macros.

In the source file

 - Change 'virObject parent' to 'GObject parent' in the struct
 - Remove the virClass variable and its initializing call
 - Add

      G_DEFINE_TYPE(virIdentity, vir_identity, G_TYPE_OBJECT)

   which declares the instance & class constructor functions

 - Add an impl of the instance & class constructors
   wiring up the finalize method to point to our dispose impl

In all files

 - Replace VIR_AUTOUNREF(virIdentityPtr) with g_autoptr(virIdentity)

 - Replace virObjectRef/Unref with g_object_ref/unref. Note
   the latter functions do *NOT* accept a NULL object where as
   libvirt's do. If you replace g_object_unref with g_clear_object
   it is NULL safe, but also clears the pointer.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
m4/virt-glib.m4
src/qemu/qemu_process.c
src/rpc/virnetserverclient.c
src/util/viridentity.c
src/util/viridentity.h
tests/viridentitytest.c