Commit e245cb85 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove no longer used vlc_gc_*()

parent da623e25
......@@ -497,26 +497,6 @@ typedef union
# define VLC_OBJECT( x ) ((vlc_object_t *)(x))
#endif
typedef struct gc_object_t
{
vlc_atomic_t refs;
void (*pf_destructor) (struct gc_object_t *);
} gc_object_t;
/**
* These members are common to all objects that wish to be garbage-collected.
*/
#define VLC_GC_MEMBERS gc_object_t vlc_gc_data;
VLC_API void * vlc_gc_init(gc_object_t *, void (*)(gc_object_t *));
VLC_API void * vlc_hold(gc_object_t *);
VLC_API void vlc_release(gc_object_t *);
#define vlc_gc_init( a,b ) vlc_gc_init( &(a)->vlc_gc_data, (b) )
#define vlc_gc_incref( a ) vlc_hold( &(a)->vlc_gc_data )
#define vlc_gc_decref( a ) vlc_release( &(a)->vlc_gc_data )
#define vlc_priv( gc, t ) ((t *)(((char *)(gc)) - offsetof(t, vlc_gc_data)))
/*****************************************************************************
* Macros and inline functions
*****************************************************************************/
......
......@@ -70,7 +70,6 @@
#include <vlc_fs.h>
#include <vlc_cpu.h>
#include <vlc_url.h>
#include <vlc_atomic.h>
#include <vlc_modules.h>
#include "libvlc.h"
......@@ -93,56 +92,6 @@
static bool b_daemon = false;
#endif
#undef vlc_gc_init
#undef vlc_hold
#undef vlc_release
/**
* Atomically set the reference count to 1.
* @param p_gc reference counted object
* @param pf_destruct destruction calback
* @return p_gc.
*/
void *vlc_gc_init (gc_object_t *p_gc, void (*pf_destruct) (gc_object_t *))
{
/* There is no point in using the GC if there is no destructor... */
assert (pf_destruct);
p_gc->pf_destructor = pf_destruct;
vlc_atomic_set (&p_gc->refs, 1);
return p_gc;
}
/**
* Atomically increment the reference count.
* @param p_gc reference counted object
* @return p_gc.
*/
void *vlc_hold (gc_object_t * p_gc)
{
uintptr_t refs;
assert( p_gc );
refs = vlc_atomic_inc (&p_gc->refs);
assert (refs != 1); /* there had to be a reference already */
return p_gc;
}
/**
* Atomically decrement the reference count and, if it reaches zero, destroy.
* @param p_gc reference counted object.
*/
void vlc_release (gc_object_t *p_gc)
{
uintptr_t refs;
assert( p_gc );
refs = vlc_atomic_dec (&p_gc->refs);
assert (refs != (uintptr_t)(-1)); /* reference underflow?! */
if (refs == 0)
p_gc->pf_destructor (p_gc);
}
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment