mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
lib: Use g_clear_pointer() more
This change was generated using the following spatch:
@ rule1 @
expression a;
identifier f;
@@
<...
- f(*a);
... when != a;
- *a = NULL;
+ g_clear_pointer(a, f);
...>
@ rule2 @
expression a;
identifier f;
@@
<...
- f(a);
... when != a;
- a = NULL;
+ g_clear_pointer(&a, f);
...>
Then, I left some of the changes out, like tools/nss/ (which
doesn't link with glib) and put back a comment in
qemuBlockJobProcessEventCompletedActiveCommit() which coccinelle
decided to remove (I have no idea why).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -171,8 +171,7 @@ testUSBList(const void *opaque G_GNUC_UNUSED)
|
||||
dev = NULL;
|
||||
}
|
||||
|
||||
virObjectUnref(devlist);
|
||||
devlist = NULL;
|
||||
g_clear_pointer(&devlist, virObjectUnref);
|
||||
|
||||
ndevs = virUSBDeviceListCount(list);
|
||||
if (testCheckNdevs("After first loop", ndevs, EXPECTED_NDEVS_ONE) < 0)
|
||||
@@ -210,8 +209,7 @@ testUSBList(const void *opaque G_GNUC_UNUSED)
|
||||
}
|
||||
|
||||
virUSBDeviceListDel(list, dev);
|
||||
virUSBDeviceFree(dev);
|
||||
dev = NULL;
|
||||
g_clear_pointer(&dev, virUSBDeviceFree);
|
||||
|
||||
if (testCheckNdevs("After deleting one",
|
||||
virUSBDeviceListCount(list),
|
||||
|
||||
Reference in New Issue
Block a user