mirror of
https://github.com/systemd/systemd.git
synced 2024-12-04 15:53:41 +08:00
macro: make TAKE_PTR() side-effect free
This commit is contained in:
parent
7950211df3
commit
b7759c8f0a
@ -257,8 +257,9 @@
|
||||
* resets it to NULL. See: https://doc.rust-lang.org/std/option/enum.Option.html#method.take */
|
||||
#define TAKE_PTR(ptr) \
|
||||
({ \
|
||||
typeof(ptr) _ptr_ = (ptr); \
|
||||
(ptr) = NULL; \
|
||||
typeof(ptr) *_pptr_ = &(ptr); \
|
||||
typeof(ptr) _ptr_ = *_pptr_; \
|
||||
*_pptr_ = NULL; \
|
||||
_ptr_; \
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user