[vlc-devel] commit: Cosmetic (input). (Laurent Aimar )

git version control git at videolan.org
Sat Mar 28 12:27:00 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Mar 27 22:46:07 2009 +0100| [45b9caaf5cf5ab3fbd8ff85387ef57a251693821] | committer: Laurent Aimar 

Cosmetic (input).

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

 src/input/input.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index c8180a7..ea40809 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2796,23 +2796,28 @@ static void SlaveSeek( input_thread_t *p_input )
  *****************************************************************************/
 static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta )
 {
+    static const struct { int i_meta; const char *psz_name; } p_list[] = {
+        { vlc_meta_Title,       "meta-title" },
+        { vlc_meta_Artist,      "meta-artist" },
+        { vlc_meta_Genre,       "meta-genre" },
+        { vlc_meta_Copyright,   "meta-copyright" },
+        { vlc_meta_Description, "meta-description" },
+        { vlc_meta_Date,        "meta-date" },
+        { vlc_meta_URL,         "meta-url" },
+        { 0, NULL }
+    };
+
     /* Get meta information from user */
-#define GET_META( field, s ) do { \
-    char *psz_string = var_GetNonEmptyString( p_input, (s) );  \
-    if( psz_string ) {\
-        EnsureUTF8( psz_string ); \
-        vlc_meta_Set( p_meta, vlc_meta_ ## field, psz_string ); \
-    } \
-    free( psz_string ); } while(0)
-
-    GET_META( Title, "meta-title" );
-    GET_META( Artist, "meta-artist" );
-    GET_META( Genre, "meta-genre" );
-    GET_META( Copyright, "meta-copyright" );
-    GET_META( Description, "meta-description" );
-    GET_META( Date, "meta-date" );
-    GET_META( URL, "meta-url" );
-#undef GET_META
+    for( int i = 0; p_list[i].psz_name; i++ )
+    {
+        char *psz_string = var_GetNonEmptyString( p_input, p_list[i].psz_name );
+        if( !psz_string )
+            continue;
+
+        EnsureUTF8( psz_string );
+        vlc_meta_Set( p_meta, p_list[i].i_meta, psz_string );
+        free( psz_string );
+    }
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list