示例#1
0
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);
    }
}
示例#2
0
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);
    }
}
示例#3
0
/*+

  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);
        }
    }
}
示例#4
0
/*+

  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);
        }
    }
}