[vlc-devel] commit: libvlccore: Make sure vlc_gc_* function correctly assert() on common errors, and de-inline them. (Pierre d'Herbemont )
git version control
git at videolan.org
Tue Jul 8 21:33:30 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Tue Jul 8 21:32:49 2008 +0200| [915f6a59a6b74d884a9ece2cd0d07f2a952cd834]
libvlccore: Make sure vlc_gc_* function correctly assert() on common errors, and de-inline them.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=915f6a59a6b74d884a9ece2cd0d07f2a952cd834
---
include/vlc_common.h | 30 ++++--------------------------
src/libvlc.c | 35 +++++++++++++++++++++++++++++++++++
src/libvlccore.sym | 3 +++
3 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 451a008..cf504c6 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -550,32 +550,10 @@ struct gc_object_t
VLC_GC_MEMBERS
};
-static inline void __vlc_gc_incref( gc_object_t * p_gc )
-{
- p_gc->i_gc_refcount ++;
-};
-
-static inline void __vlc_gc_decref( gc_object_t *p_gc )
-{
- if( !p_gc ) return;
-
- p_gc->i_gc_refcount -- ;
-
- if( p_gc->i_gc_refcount == 0 )
- {
- p_gc->pf_destructor( p_gc );
- /* Do not use the p_gc pointer from now on ! */
- }
-}
-
-static inline void
-__vlc_gc_init( gc_object_t * p_gc, void (*pf_destructor)( gc_object_t * ),
- void * arg)
-{
- p_gc->i_gc_refcount = 1;
- p_gc->pf_destructor = pf_destructor;
- p_gc->p_destructor_arg = arg;
-}
+VLC_EXPORT(void, __vlc_gc_incref, ( gc_object_t * p_gc ));
+VLC_EXPORT(void, __vlc_gc_decref, ( gc_object_t * p_gc ));
+VLC_EXPORT(void, __vlc_gc_init, ( gc_object_t * p_gc,
+ void (*pf_destructor)( gc_object_t * ), void * arg));
#define vlc_gc_incref( a ) __vlc_gc_incref( (gc_object_t *)a )
#define vlc_gc_decref( a ) __vlc_gc_decref( (gc_object_t *)a )
diff --git a/src/libvlc.c b/src/libvlc.c
index f68221f..7340e36 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -106,6 +106,41 @@ static unsigned i_instances = 0;
static bool b_daemon = false;
/*****************************************************************************
+ * vlc_gc_*.
+ *****************************************************************************/
+void __vlc_gc_incref( gc_object_t * p_gc )
+{
+ assert( p_gc->i_gc_refcount > 0 );
+
+ /* FIXME: atomic version needed! */
+ p_gc->i_gc_refcount ++;
+}
+
+void __vlc_gc_decref( gc_object_t *p_gc )
+{
+ assert( p_gc );
+ assert( p_gc->i_gc_refcount > 0 );
+
+ /* FIXME: atomic version needed! */
+ p_gc->i_gc_refcount -- ;
+
+ if( p_gc->i_gc_refcount == 0 )
+ {
+ p_gc->pf_destructor( p_gc );
+ /* Do not use the p_gc pointer from now on ! */
+ }
+}
+
+void
+__vlc_gc_init( gc_object_t * p_gc, void (*pf_destructor)( gc_object_t * ),
+ void * arg)
+{
+ p_gc->i_gc_refcount = 1;
+ p_gc->pf_destructor = pf_destructor;
+ p_gc->p_destructor_arg = arg;
+}
+
+/*****************************************************************************
* Local prototypes
*****************************************************************************/
#if defined( ENABLE_NLS ) && (defined (__APPLE__) || defined (WIN32)) && \
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index d74bd7a..9ea4976 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -414,6 +414,9 @@ __vlc_execve
vlc_fastmem_register
vlc_freeaddrinfo
vlc_gai_strerror
+__vlc_gc_incref
+__vlc_gc_init
+__vlc_gc_decref
vlc_getaddrinfo
vlc_getnameinfo
vlc_gettext
More information about the vlc-devel
mailing list