]> git.sesse.net Git - vlc/blobdiff - src/libvlc-common.c
Fix for libvlc_config crash (hopefully)
[vlc] / src / libvlc-common.c
index 2c83d899054b12b3fdacd4a7bd69c5b3a4c60e26..468fd953bc3da85968abf0302db83057f2245b46 100644 (file)
@@ -37,7 +37,7 @@
 #include <vlc_input.h>
 
 #include "modules/modules.h"
-#include "modules/configuration.h"
+#include "config/config.h"
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdio.h>                                              /* sprintf() */
@@ -214,7 +214,8 @@ libvlc_int_t * libvlc_InternalCreate( void )
     /* Announce who we are - Do it only for first instance ? */
     msg_Dbg( p_libvlc, COPYRIGHT_MESSAGE );
     msg_Dbg( p_libvlc, "libvlc was configured with %s", CONFIGURE_LINE );
-    msg_Info( p_libvlc, "Running vlc with the default interface. Use 'cvlc' to use vlc without interface.");
+    if( strcmp( p_libvlc->psz_object_name, "cvlc" ) ) /* Not running with cvlc */
+        msg_Info( p_libvlc, "Running vlc with the default interface. Use 'cvlc' to use vlc without interface.");
 
     /* Initialize mutexes */
     vlc_mutex_init( p_libvlc, &p_libvlc->config_lock );
@@ -262,11 +263,11 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     /* Get the executable name (similar to the basename command) */
     if( i_argc > 0 )
     {
-        p_libvlc->psz_object_name = p_tmp = ppsz_argv[ 0 ];
-        while( *p_tmp )
+        const char *exe = p_libvlc->psz_object_name = ppsz_argv[0];
+        while( *exe )
         {
-            if( *p_tmp == '/' ) p_libvlc->psz_object_name = ++p_tmp;
-            else ++p_tmp;
+            if( *exe++ == '/' )
+                p_libvlc->psz_object_name = exe;
         }
     }
     else
@@ -304,7 +305,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     if( config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE ) )
     {
         vlc_object_detach( p_help_module );
-        config_Free( p_help_module );
+        p_help_module->p_config = NULL;
+        p_help_module->confsize = 0;
         vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return VLC_EGENERIC;
@@ -412,7 +414,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
     if( b_exit )
     {
-        config_Free( p_help_module );
+        p_help_module->p_config = NULL; p_help_module->confsize = 0;
         vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return i_ret;
@@ -522,7 +524,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
     if( b_exit )
     {
-        config_Free( p_help_module );
+        p_help_module->p_config = NULL; p_help_module->confsize = 0;
         vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return i_ret;
@@ -555,7 +557,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
         PauseConsole();
 #endif
         vlc_object_detach( p_help_module );
-        config_Free( p_help_module );
+        p_help_module->p_config = NULL; p_help_module->confsize = 0;
         vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return VLC_EGENERIC;
@@ -563,7 +565,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
     /* Hack: remove the help module here */
     vlc_object_detach( p_help_module );
-    config_Free( p_help_module );
+    p_help_module->p_config = NULL; p_help_module->confsize = 0;
     vlc_object_destroy( p_help_module );
     /* End hack */
 
@@ -1453,8 +1455,8 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
             signed int i;
             size_t i_cur_width;
 
-            /* Skip deprecated options */
-            if( p_item->psz_current )
+            /* Skip removed options */
+            if( p_item->b_removed )
             {
                 continue;
             }
@@ -1808,14 +1810,6 @@ static void ListModules( libvlc_int_t *p_this, vlc_bool_t b_verbose )
                                   p_parser->psz_capability,
                                   p_parser->i_score );
             }
-            if( p_parser->psz_program )
-            {
-                if( b_color )
-                    utf8_fprintf( stdout, YELLOW "   p %s\n"GRAY,
-                                  p_parser->psz_program );
-                else
-                    utf8_fprintf( stdout, "   p %s\n", p_parser->psz_program );
-            }
         }
 
         psz_spaces[i] = ' ';