diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2022-01-28 18:42:45 +0100 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2022-02-08 08:42:07 +0100 |
commit | 87a43a907f0ad4897a28ad7c216bc70f37270b93 (patch) | |
tree | 77becc044a219aed11f5522edb39fc8aa3cd66ae /tests/commandtest.c | |
parent | 1688d2527f1ae34d57d0b5c01fbea79e40dac7b7 (diff) | |
download | libvirt-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 'tests/commandtest.c')
-rw-r--r-- | tests/commandtest.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/commandtest.c b/tests/commandtest.c index 5267e1bf1c..74e60a072b 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -446,8 +446,7 @@ static int test13(const void *unused G_GNUC_UNUSED) if (!outactual) goto cleanup; - virCommandFree(cmd); - cmd = NULL; + g_clear_pointer(&cmd, virCommandFree); if (STRNEQ(outactual, outexpect)) { virTestDifference(stderr, outexpect, outactual); @@ -668,8 +667,7 @@ static int test18(const void *unused G_GNUC_UNUSED) goto cleanup; } - virCommandFree(cmd); - cmd = NULL; + g_clear_pointer(&cmd, virCommandFree); if (kill(pid, 0) != 0) { printf("daemon should still be running\n"); goto cleanup; |