mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-capture: Use sysprof_{steal,clear}_pointer() instead of GLib
They work exactly the same way as the GLib functions. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #40
This commit is contained in:
@ -60,3 +60,14 @@
|
||||
#pragma once
|
||||
|
||||
#define sysprof_assert_not_reached() assert (false)
|
||||
|
||||
#define sysprof_steal_pointer(pp) __extension__ ({__typeof(*(pp)) _p = *(pp); *(pp) = NULL; _p;})
|
||||
|
||||
#define sysprof_clear_pointer(pp, destroy) \
|
||||
do { \
|
||||
__typeof((pp)) _pp = (pp); \
|
||||
__typeof(*(pp)) _p = *_pp; \
|
||||
*_pp = NULL; \
|
||||
if (_p != NULL) \
|
||||
(destroy) (_p); \
|
||||
} while (0)
|
||||
|
||||
Reference in New Issue
Block a user