diff options
Diffstat (limited to 'shared/nm-std-aux/nm-std-aux.h')
-rw-r--r-- | shared/nm-std-aux/nm-std-aux.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shared/nm-std-aux/nm-std-aux.h b/shared/nm-std-aux/nm-std-aux.h index 026fafdcc7..2351198930 100644 --- a/shared/nm-std-aux/nm-std-aux.h +++ b/shared/nm-std-aux/nm-std-aux.h @@ -520,4 +520,22 @@ NM_AUTO_DEFINE_FCN_VOID0 (void *, _nm_auto_free_impl, free) _changed; \ }) +#define nm_clear_free(pp) nm_clear_pointer (pp, free) + +/*****************************************************************************/ + +static inline void * +_nm_steal_pointer (void *pp) +{ + void **ptr = (void **) pp; + void *ref; + + ref = *ptr; + *ptr = NULL; + return ref; +} + +#define nm_steal_pointer(pp) \ + ((typeof (*(pp))) _nm_steal_pointer (pp)) + #endif /* __NM_STD_AUX_H__ */ |