mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
internal: Introduce macro for stealing pointers
VIR_STEAL_PTR copies the pointer from the second argument into the first argument and then sets the second to NULL.
This commit is contained in:
parent
d5813d72ad
commit
5b7dedc995
@ -306,6 +306,18 @@
|
|||||||
(a) = (a) ^ (b); \
|
(a) = (a) ^ (b); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIR_STEAL_PTR:
|
||||||
|
*
|
||||||
|
* Steals pointer passed as second argument into the first argument. Second
|
||||||
|
* argument must not have side effects.
|
||||||
|
*/
|
||||||
|
# define VIR_STEAL_PTR(a, b) \
|
||||||
|
do { \
|
||||||
|
(a) = (b); \
|
||||||
|
(b) = NULL; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virCheckFlags:
|
* virCheckFlags:
|
||||||
* @supported: an OR'ed set of supported flags
|
* @supported: an OR'ed set of supported flags
|
||||||
|
Loading…
Reference in New Issue
Block a user