mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
lib: Use more of VIR_STEAL_PTR()
We have this very handy macro called VIR_STEAL_PTR() which steals
one pointer into the other and sets the other to NULL. The
following coccinelle patch was used to create this commit:
@ rule1 @
identifier a, b;
@@
- b = a;
...
- a = NULL;
+ VIR_STEAL_PTR(b, a);
Some places were clean up afterwards to make syntax-check happy
(e.g. some curly braces were removed where the body become a one
liner).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
@@ -1356,8 +1356,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
|
||||
virshSnapSorter);
|
||||
snaplist->nsnaps -= deleted;
|
||||
|
||||
ret = snaplist;
|
||||
snaplist = NULL;
|
||||
VIR_STEAL_PTR(ret, snaplist);
|
||||
|
||||
cleanup:
|
||||
virshSnapshotListFree(snaplist);
|
||||
|
||||
Reference in New Issue
Block a user