[vlc-commits] system_Init(): remove unused arguments

Rafaël Carré git at videolan.org
Wed Jun 15 23:13:03 CEST 2011


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Wed Jun 15 00:29:25 2011 -0400| [04526ea89fbcc3bf69c1b6522253f30f35767b2b] | committer: Rafaël Carré

system_Init(): remove unused arguments

darwin relied on argv[0] as a fallback to retrieve executable name,
but this can't work anymore as:
- libvlc_new() can be given anything as argc/argv
- libvlc_new() inserts "libvlc" at position 0 anyway

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

 src/libvlc.c                |    2 +-
 src/libvlc.h                |    2 +-
 src/posix/darwin_specific.c |    9 +--------
 src/posix/linux_specific.c  |    4 +---
 src/posix/specific.c        |    3 +--
 src/win32/specific.c        |    3 +--
 6 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index 6097529..c53d6be 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -268,7 +268,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 #endif
 
     /* System specific initialization code */
-    system_Init( p_libvlc, &i_argc, ppsz_argv );
+    system_Init();
 
     /*
      * Support for gettext
diff --git a/src/libvlc.h b/src/libvlc.h
index 99fc643..c702cc0 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -37,7 +37,7 @@ size_t vlc_towc (const char *str, uint32_t *restrict pwc);
 /*
  * OS-specific initialization
  */
-void system_Init      ( libvlc_int_t *, int *, const char *[] );
+void system_Init      ( void );
 void system_Configure ( libvlc_int_t *, int, const char *const [] );
 void system_End       ( libvlc_int_t * );
 
diff --git a/src/posix/darwin_specific.c b/src/posix/darwin_specific.c
index 810bd1b..9dead94 100644
--- a/src/posix/darwin_specific.c
+++ b/src/posix/darwin_specific.c
@@ -47,14 +47,12 @@
 /*****************************************************************************
  * system_Init: fill in program path & retrieve language
  *****************************************************************************/
-void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
+void system_Init(void)
 {
-    VLC_UNUSED(p_this);
     char i_dummy;
     char *p_char = NULL;
     char *p_oldchar = &i_dummy;
     unsigned int i;
-    (void)pi_argc;
 
     /* Get the full program path and name */
     /* First try to see if we are linked to the framework */
@@ -107,11 +105,6 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
         if ( !_NSGetExecutablePath(path, &path_len) )
             p_char = strdup(path);
     }
-    if( !p_char )
-    {
-        /* We are not linked to the VLC.framework, return the executable path */
-        p_char = strdup( ppsz_argv[ 0 ] );
-    }
 
     free(psz_vlcpath);
     psz_vlcpath = p_char;
diff --git a/src/posix/linux_specific.c b/src/posix/linux_specific.c
index 1644ce6..11dd6d6 100644
--- a/src/posix/linux_specific.c
+++ b/src/posix/linux_specific.c
@@ -88,7 +88,7 @@ static struct
 # include <stdlib.h>
 #endif
 
-void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
+void system_Init (void)
 {
 #ifdef __GLIBC__
     const char *glcv = gnu_get_libc_version ();
@@ -111,8 +111,6 @@ void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
     if (once.refs++ == 0)
         set_libvlc_path ();
     vlc_mutex_unlock (&once.lock);
-
-    (void)libvlc; (void)argc; (void)argv;
 }
 
 void system_Configure (libvlc_int_t *libvlc,
diff --git a/src/posix/specific.c b/src/posix/specific.c
index df917c1..cd53a96 100644
--- a/src/posix/specific.c
+++ b/src/posix/specific.c
@@ -31,12 +31,11 @@ static void set_libvlc_path (void)
     psz_vlcpath = (char *)PKGLIBDIR;
 }
 
-void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
+void system_Init (void)
 {
     pthread_once_t once = PTHREAD_ONCE_INIT;
 
     pthread_once (&once, set_libvlc_path);
-    (void)libvlc; (void)argc; (void)argv;
 }
 
 void system_Configure (libvlc_int_t *libvlc,
diff --git a/src/win32/specific.c b/src/win32/specific.c
index 7a47e82..3a4d0a1 100644
--- a/src/win32/specific.c
+++ b/src/win32/specific.c
@@ -44,9 +44,8 @@
 /*****************************************************************************
  * system_Init: initialize winsock and misc other things.
  *****************************************************************************/
-void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
+void system_Init( void )
 {
-    VLC_UNUSED( p_this ); VLC_UNUSED( pi_argc ); VLC_UNUSED( ppsz_argv );
     WSADATA Data;
     MEMORY_BASIC_INFORMATION mbi;
 



More information about the vlc-commits mailing list