mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
spa: utils: spa_exchange(): try to evaluate argument only once
This commit is contained in:
parent
71808454e7
commit
3fec887a5f
1 changed files with 3 additions and 2 deletions
|
|
@ -35,8 +35,9 @@ static inline void _spa_autoptr_cleanup_func_ ## name (__typeof__(type) **thing)
|
||||||
|
|
||||||
#define spa_exchange(var, new_value) \
|
#define spa_exchange(var, new_value) \
|
||||||
__extension__ ({ \
|
__extension__ ({ \
|
||||||
__typeof__(var) _old_value = (var); \
|
__typeof__(var) *_ptr = &(var); \
|
||||||
(var) = (new_value); \
|
__typeof__(var) _old_value = *_ptr; \
|
||||||
|
*_ptr = (new_value); \
|
||||||
_old_value; \
|
_old_value; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue