[vlc-commits] commit: M3U export: small code factorization ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Tue Aug 17 18:45:58 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 17 19:45:29 2010 +0300| [f5a892046e02230becaf64d80d9d1074ca9fcaf9] | committer: Rémi Denis-Courmont 

M3U export: small code factorization

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

 modules/misc/playlist/m3u.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/modules/misc/playlist/m3u.c b/modules/misc/playlist/m3u.c
index 5e69ae3..72e9581 100644
--- a/modules/misc/playlist/m3u.c
+++ b/modules/misc/playlist/m3u.c
@@ -50,10 +50,11 @@ int Export_M3U8( vlc_object_t * );
 static void DoChildren( playlist_export_t *p_export, playlist_item_t *p_root,
                         int (*pf_fprintf) (FILE *, const char *, ...) )
 {
-    int i, j;
+    /* Write header */
+    fputs( "#EXTM3U\n", p_export->p_file );
 
     /* Go through the playlist and add items */
-    for( i = 0; i< p_root->i_children ; i++)
+    for( int i = 0; i< p_root->i_children ; i++)
     {
         playlist_item_t *p_current = p_root->pp_children[i];
         assert( p_current );
@@ -97,7 +98,7 @@ static void DoChildren( playlist_export_t *p_export, playlist_item_t *p_root,
 
         /* VLC specific options */
         vlc_mutex_lock( &p_current->p_input->lock );
-        for( j = 0; j < p_current->p_input->i_options; j++ )
+        for( int j = 0; j < p_current->p_input->i_options; j++ )
         {
             pf_fprintf( p_export->p_file, "#EXTVLCOPT:%s\n",
                         p_current->p_input->ppsz_options[j][0] == ':' ?
@@ -124,9 +125,6 @@ int Export_M3U( vlc_object_t *p_this )
 
     msg_Dbg( p_export, "saving using M3U format");
 
-    /* Write header */
-    fputs( "#EXTM3U\n", p_export->p_file );
-
     DoChildren( p_export, p_export->p_root, utf8_fprintf );
     return VLC_SUCCESS;
 }
@@ -137,9 +135,6 @@ int Export_M3U8( vlc_object_t *p_this )
 
     msg_Dbg( p_export, "saving using M3U8 format");
 
-    /* Write header */
-    fputs( "#EXTM3U\n", p_export->p_file );
-
     DoChildren( p_export, p_export->p_root, fprintf );
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list