void context_info_db_unref(ContextInfoDB *self) { g_assert(!self || g_atomic_counter_get(&self->ref_cnt)); if (g_atomic_counter_dec_and_test(&self->ref_cnt)) { context_info_db_free(self); } }
void log_pipe_unref(LogPipe *self) { g_assert(!self || g_atomic_counter_get(&self->ref_cnt)); if (self && (g_atomic_counter_dec_and_test(&self->ref_cnt))) { if (self->free_fn) self->free_fn(self); g_free(self); } }
/*+ Decrement the reference count of a GSockAddr instance, and free if the refcnt reaches 0. Parameters: a GSockAddr instance Returns: none +*/ void g_sockaddr_unref(GSockAddr *a) { /* FIXME: maybe add a callback to funcs table */ if (a) { if (g_atomic_counter_dec_and_test(&a->refcnt)) { g_slice_free1(g_sockaddr_len(a), a); } } }
/*+ Decrement the reference count of a GSockAddr instance, and free if the refcnt reaches 0. Parameters: a GSockAddr instance Returns: none +*/ void g_sockaddr_unref(GSockAddr *a) { /* FIXME: maybe add a callback to funcs table */ if (a) { if (g_atomic_counter_dec_and_test(&a->refcnt)) { if (!a->sa_funcs->freefn) g_free(a); else a->sa_funcs->freefn(a); } } }