[vlc-devel] commit: libvlc_free: wrapper around free() when the C run-time is not known ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 21 17:15:15 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Feb 21 16:41:04 2009 +0200| [d2e7edbdb2edf1afde6e67bef8161025dcbcad4a] | committer: Rémi Denis-Courmont 

libvlc_free: wrapper around free() when the C run-time is not known

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d2e7edbdb2edf1afde6e67bef8161025dcbcad4a
---

 include/vlc/libvlc.h |    7 +++++++
 src/control/core.c   |    5 +++++
 src/libvlc.sym       |    1 +
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index 3b8d8fc..b953441 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -224,6 +224,13 @@ struct vlc_object_t;
  */
 VLC_PUBLIC_API struct vlc_object_t *libvlc_get_vlc_instance(libvlc_instance_t *);
 
+/**
+ * Frees an heap allocation (char *) returned by a LibVLC API.
+ * If you know you're using the same underlying C run-time as the LibVLC
+ * implementation, then you can call ANSI C free() directly instead.
+ */
+VLC_PUBLIC_API void libvlc_free( void *ptr );
+
 /** @}*/
 
 /*****************************************************************************
diff --git a/src/control/core.c b/src/control/core.c
index af592b9..e52b3cb 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -215,3 +215,8 @@ vlc_object_t *libvlc_get_vlc_instance( libvlc_instance_t* p_instance )
     vlc_object_hold( p_instance->p_libvlc_int ) ;
     return (vlc_object_t*) p_instance->p_libvlc_int ;
 }
+
+void libvlc_free( void *ptr )
+{
+    free( ptr );
+}
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 8de9c3f..759744d 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -31,6 +31,7 @@ libvlc_exception_get_message
 libvlc_exception_init
 libvlc_exception_raise
 libvlc_exception_raised
+libvlc_free
 libvlc_get_changeset
 libvlc_get_compiler
 libvlc_get_fullscreen




More information about the vlc-devel mailing list