]> git.sesse.net Git - vlc/blobdiff - src/libvlc.c
Check that hotkeys are sorted properly (debug-only self-test)
[vlc] / src / libvlc.c
index 53b77470bd344a62ee32f4f3253cdb4fd35ce578..c3087573effd011e093f40c29cfd77f338dd53a8 100644 (file)
@@ -817,13 +817,22 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
         struct hotkey *p_keys =
             malloc( (libvlc_actions_count + 1) * sizeof (*p_keys) );
 
-       /* Initialize from configuration */
+        /* Initialize from configuration */
         for( size_t i = 0; i < libvlc_actions_count; i++ )
         {
             p_keys[i].psz_action = libvlc_actions[i].name;
             p_keys[i].i_key = config_GetInt( p_libvlc,
                                              libvlc_actions[i].name );
             p_keys[i].i_action = libvlc_actions[i].value;
+#ifndef NDEBUG
+            if (i > 0
+             && strcmp(libvlc_actions[i-1].name, libvlc_actions[i].name) >= 0)
+            {
+                msg_Err(p_libvlc, "%s and %s are not ordered properly",
+                        libvlc_actions[i-1].name, libvlc_actions[i].name);
+                abort();
+            }
+#endif
         }
         p_keys[libvlc_actions_count].psz_action = NULL;
         p_keys[libvlc_actions_count].i_key = 0;
@@ -1921,6 +1930,9 @@ static void ListModules( libvlc_int_t *p_this, bool b_verbose )
 #ifdef WIN32
     ShowConsole( true );
     b_color = false; // don't put color control codes in a .txt file
+#else
+    if( !isatty( 1 ) )
+        b_color = false;
 #endif
 
     /* List all modules */