summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2022-01-28 18:42:45 +0100
committerMichal Privoznik <mprivozn@redhat.com>2022-02-08 08:42:07 +0100
commit87a43a907f0ad4897a28ad7c216bc70f37270b93 (patch)
tree77becc044a219aed11f5522edb39fc8aa3cd66ae /src/test
parent1688d2527f1ae34d57d0b5c01fbea79e40dac7b7 (diff)
downloadlibvirt-87a43a907f0ad4897a28ad7c216bc70f37270b93.tar.gz
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>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_driver.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f900123941..03c41ca192 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1537,8 +1537,7 @@ testConnectOpen(virConnectPtr conn,
/* Fake authentication. */
if (testConnectAuthenticate(conn, auth) < 0) {
- testDriverCloseInternal(conn->privateData);
- conn->privateData = NULL;
+ g_clear_pointer(&conn->privateData, testDriverCloseInternal);
return VIR_DRV_OPEN_ERROR;
}
@@ -1549,8 +1548,7 @@ testConnectOpen(virConnectPtr conn,
static int
testConnectClose(virConnectPtr conn)
{
- testDriverCloseInternal(conn->privateData);
- conn->privateData = NULL;
+ g_clear_pointer(&conn->privateData, testDriverCloseInternal);
return 0;
}