]> git.sesse.net Git - vlc/blobdiff - extras/zsh.cpp
Memory leak
[vlc] / extras / zsh.cpp
index b0fb9aa5555d5350f3c5ef8a34b315bd01d34e9a..10120b56b8c57ce9dd47373976d15612cbdc10f8 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * zsh.cpp: create zsh completion rule for vlc
  *****************************************************************************
- * Copyright (C) 1998-2005 VideoLAN
+ * Copyright (C) 2005 the VideoLAN team
  * $Id$
  *
- * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
+ * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include <stdio.h>
@@ -40,7 +40,6 @@ void PrintModuleList( vlc_t *p_vlc, mmap &mods, mcmap &mods2 );
 void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 );
 void PrintOption( char *psz_option, char i_short, char *psz_exlusive,
                    char *psz_text, char *psz_longtext, char *psz_args );
-extern "C"{ vlc_t * vlc_current_object( int i_object );}
 
 int main( int i_argc, char **ppsz_argv )
 {
@@ -49,7 +48,7 @@ int main( int i_argc, char **ppsz_argv )
     /* Create a libvlc structure */
     int i_ret = VLC_Create();
     vlc_t *p_vlc;
-    
+
     if( i_ret < 0 )
     {
         return i_ret;
@@ -197,6 +196,10 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
     char *psz_arguments = "";
     char *psz_exclusive;
     char *psz_option;
+    //Skip deprecated options
+    if( p_item->psz_current )
+        return;
+    
     switch( p_item->i_type )
     {
     case CONFIG_ITEM_MODULE:
@@ -377,7 +380,8 @@ void PrintOption( char *psz_option, char i_short, char *psz_exclusive,
     if( !psz_longtext ||
         strchr( psz_longtext, '\n' ) ||
         strchr( psz_longtext, '(' ) ) psz_longtext = psz_text;
-    while( (foo = strchr( psz_text, '"' ))) *foo='\'';
+    if( psz_text )
+        while( (foo = strchr( psz_text, '"' ))) *foo='\'';
     if( i_short )
     {
         if( !psz_exclusive ) psz_exclusive = "";