[vlc-commits] python bindings: emulate libvlc_free with a no-op on win32

Olivier Aubert git at videolan.org
Wed May 18 14:56:50 CEST 2011


vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Wed May 18 14:50:51 2011 +0200| [a5ba843f98dc8a1f654a7f9a89782834e4679614] | committer: Olivier Aubert

python bindings: emulate libvlc_free with a no-op on win32

If libvlc does not define libvlc_free, emulate it with a no-op on win32: it will produce a memleak but not prevent the application to run.

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

 footer.py        |    7 ++++---
 generated/vlc.py |    9 +++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/footer.py b/footer.py
index 9315350..0ad814e 100644
--- a/footer.py
+++ b/footer.py
@@ -15,12 +15,13 @@ if not hasattr(dll, 'libvlc_free'):
     libc_path = find_library('c')
     if libc_path:
         libc = ctypes.CDLL(libc_path)
-        libvlc_free = libc.free        
+        libvlc_free = libc.free
     else:
         # On win32, it is impossible to guess the proper lib to call
-        # (msvcrt, mingw...). Just raise an exception.
+        # (msvcrt, mingw...). Just ignore the call: it will memleak,
+        # but not prevent to run the application.
         def libvlc_free(p):
-            raise NotImplementedError('%s: %s without libvlc_free not supported' % (sys.argv[0], sys.platform))
+            pass
 
     # ensure argtypes is right, because default type of int won't work
     # on 64-bit systems
diff --git a/generated/vlc.py b/generated/vlc.py
index 0f75af9..eec658e 100755
--- a/generated/vlc.py
+++ b/generated/vlc.py
@@ -47,7 +47,7 @@ import sys
 from inspect import getargspec
 
 __version__ = "N/A"
-build_date  = "Sun May 15 18:04:05 2011"
+build_date  = "Wed May 18 14:50:18 2011"
 
  # Used on win32 and MacOS in override.py
 plugin_path = None
@@ -6019,12 +6019,13 @@ if not hasattr(dll, 'libvlc_free'):
     libc_path = find_library('c')
     if libc_path:
         libc = ctypes.CDLL(libc_path)
-        libvlc_free = libc.free        
+        libvlc_free = libc.free
     else:
         # On win32, it is impossible to guess the proper lib to call
-        # (msvcrt, mingw...). Just raise an exception.
+        # (msvcrt, mingw...). Just ignore the call: it will memleak,
+        # but not prevent to run the application.
         def libvlc_free(p):
-            raise NotImplementedError('%s: %s without libvlc_free not supported' % (sys.argv[0], sys.platform))
+            pass
 
     # ensure argtypes is right, because default type of int won't work
     # on 64-bit systems



More information about the vlc-commits mailing list