]> git.sesse.net Git - vlc/commitdiff
Replace CONFIG_HINT and CONFIG_ITEM with a boolean macro
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 29 Jun 2011 18:33:51 +0000 (21:33 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 29 Jun 2011 19:39:26 +0000 (22:39 +0300)
12 files changed:
extras/analyser/zsh.cpp
include/vlc_configuration.h
modules/gui/macosx/intf.m
modules/gui/macosx/prefs.m
modules/gui/macosx/simple_prefs.m
modules/gui/qt4/components/complete_preferences.cpp
modules/gui/qt4/components/preferences_widgets.cpp
src/config/cmdline.c
src/config/core.c
src/config/file.c
src/libvlc.c
src/modules/entry.c

index e152b42bd512ed3493bca7bf1a55423a49010592..c7aba2396afbe39957d1c4a748190367c3766b4e 100644 (file)
@@ -134,16 +134,14 @@ void ParseModules( mumap &mods, mcmap &mods2 )
         i_items = 0;
         do
         {
-            if( p_item->i_type == CONFIG_CATEGORY )
-            {
-//                printf( "  #Category %d\n", p_item->i_value );
-            }
-            else if( p_item->i_type == CONFIG_SUBCATEGORY )
-            {
-//                printf( "  #Subcategory %d\n", p_item->i_value );
-            }
-            if( p_item->i_type & CONFIG_ITEM )
+            if( CONFIG_ITEM(p_item->i_type) )
                 ParseOption( p_item, mods, mods2 );
+#if 0
+            else if( p_item->i_type == CONFIG_CATEGORY )
+                printf( "  #Category %d\n", p_item->i_value );
+            else if( p_item->i_type == CONFIG_SUBCATEGORY )
+                printf( "  #Subcategory %d\n", p_item->i_value );
+#endif
         }
         while( ++i_items < p_module->confsize && p_item++ );
 
index 78effe73717679616e9573946b70e58e7f71694d..c4964e48fd885d8e8ff47f437cef03cc4864a6eb 100644 (file)
@@ -52,8 +52,6 @@ extern "C" {
 #define CONFIG_SUBCATEGORY                  0x0007 /* Set subcategory */
 #define CONFIG_SECTION                      0x0008 /* Start of new section */
 
-#define CONFIG_HINT                         0x000F
-
 /* Configuration item types */
 #define CONFIG_ITEM_STRING                  0x0010  /* String option */
 /* unused 0x0020 */
@@ -71,7 +69,7 @@ extern "C" {
 #define CONFIG_ITEM_LOADFILE                0x00E0  /* Read file option */
 #define CONFIG_ITEM_SAVEFILE                0x00F0  /* Written file option */
 
-#define CONFIG_ITEM                         0x00F0
+#define CONFIG_ITEM(x) (((x) & 0xF0) != 0)
 
 /*******************************************************************
  * All predefined categories and subcategories
index 908b49f9c73bb375d6715ccdab9e1a7f12e7952d..606d7f31771efbaf3b03f7073a8d4ad8df9e6669 100644 (file)
@@ -1068,7 +1068,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
     {
         module_config_t *p_item = p_config + i;
 
-        if( (p_item->i_type & CONFIG_ITEM) && p_item->psz_name != NULL
+        if( CONFIG_ITEM(p_item->i_type) && p_item->psz_name != NULL
            && !strncmp( p_item->psz_name , "key-", 4 )
            && !EMPTY_STR( p_item->psz_text ) )
         {
index de04314bfa4cbd474d35a091a87c9b62c8802581..3cb744acd7c003a8a0f1f8f3c60a417ac9248e7c 100644 (file)
@@ -385,7 +385,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
                 }
             }
             
-            if( module_is_main( p_module) && (configType & CONFIG_ITEM) )
+            if( module_is_main( p_module) && CONFIG_ITEM(configType) )
             {
                 if( categoryItem && [self isSubCategoryGeneral:lastsubcat] )
                 {
@@ -396,7 +396,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
                     [[subCategoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]];
                 }
             }
-            else if( !module_is_main( p_module) && (configType & CONFIG_ITEM))
+            else if( !module_is_main( p_module) && CONFIG_ITEM(configType))
             {
                 if( ![[subCategoryItem children] containsObject: pluginItem] )
                 {
index 3268822bff3e225ac8a5e5e085b54066949e36ed..8d107409b703600306c2a85fae5bb33d0603887f 100644 (file)
@@ -628,7 +628,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
     {
         module_config_t *p_item = p_config + i;
 
-        if( (p_item->i_type & CONFIG_ITEM) && p_item->psz_name != NULL
+        if( CONFIG_ITEM(p_item->i_type) && p_item->psz_name != NULL
            && !strncmp( p_item->psz_name , "key-", 4 )
            && !EMPTY_STR( p_item->psz_text ) )
         {
index f29f1beb72340327da07d11d5901834ba870b7e9..32629dd03009ff4ad12d1b1fd88c557e6019e502 100644 (file)
@@ -213,7 +213,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
             else if( p_item->i_type == CONFIG_SUBCATEGORY )
                 i_subcategory = p_item->value.i;
 
-            if( p_item->i_type & CONFIG_ITEM )
+            if( CONFIG_ITEM(p_item->i_type) )
                 b_options = true;
 
             if( b_options && i_category && i_subcategory )
index 3ed751c11b8057007844c4ef2449e9b215bbfb56..4ef44ea8f9cd5a95d7157d92e07d986784c01d68 100644 (file)
@@ -1255,7 +1255,7 @@ void KeySelectorControl::finish()
         module_config_t *p_item = p_config + i;
 
         /* If we are a (non-global) key option not empty */
-        if( (p_item->i_type & CONFIG_ITEM) && p_item->psz_name != NULL
+        if( CONFIG_ITEM(p_item->i_type) && p_item->psz_name != NULL
          && !strncmp( p_item->psz_name , "key-", 4 )
          && !EMPTY_STR( p_item->psz_text ) )
         {
@@ -1277,7 +1277,7 @@ void KeySelectorControl::finish()
             continue;
         }
 
-        if( (p_item->i_type & CONFIG_ITEM) && p_item->psz_name != NULL
+        if( CONFIG_ITEM(p_item->i_type) && p_item->psz_name != NULL
          && !strncmp( p_item->psz_name , "global-key", 10 )
          && !EMPTY_STR( p_item->psz_text ) )
         {
index eea7a506bfc0cb82f591f309776e4fea5e834446..ecdc5ff25563394e1a5bb5fb76ed879bdee17243 100644 (file)
@@ -133,7 +133,7 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
              p_item++ )
         {
             /* Ignore hints */
-            if( p_item->i_type & CONFIG_HINT )
+            if( !CONFIG_ITEM(p_item->i_type) )
                 continue;
 
             /* Add item to long options */
index 0faebe2db578a6baf8ee99470bc99ab04b5b803f..27f24ac1160a6a71fa32d96c87977b53c0d46e95 100644 (file)
@@ -408,7 +408,7 @@ int config_SortConfig (void)
              item < end;
              item++)
         {
-            if (item->i_type & CONFIG_HINT)
+            if (!CONFIG_ITEM(item->i_type))
                 continue; /* ignore hints */
             clist[nconf++] = item;
         }
index e6951bff155e849048d544e4cc11a4fbc5696b7f..df296188bca80404bb8f016b77af680b150af133 100644 (file)
@@ -512,7 +512,7 @@ static int SaveConfigFile (vlc_object_t *p_this)
              p_item < p_end;
              p_item++ )
         {
-            if ((p_item->i_type & CONFIG_HINT) /* ignore hint */
+            if (!CONFIG_ITEM(p_item->i_type)   /* ignore hint */
              || p_item->b_removed              /* ignore deprecated option */
              || p_item->b_unsaveable)          /* ignore volatile option */
                 continue;
index 4aa27ffe0c4892563ddd505f4e08ae27cdd10309..2a950fddaaef015b0f5e58869ec391c52d972752 100644 (file)
@@ -1425,7 +1425,7 @@ static void Usage( libvlc_int_t *p_this, char const *psz_search )
                  p_item < p_end;
                  p_item++ )
             {
-                if( (p_item->i_type & CONFIG_ITEM) &&
+                if( CONFIG_ITEM(p_item->i_type) &&
                     !p_item->b_advanced && !p_item->b_removed ) break;
             }
 
index bbbf2ae3b82f147fe2b49d066e5806c77e957e0c..e47e2d99bab85c7a2b858553ee2e31fac1ff6d7d 100644 (file)
@@ -140,7 +140,7 @@ static module_config_t *vlc_config_create (module_t *module, int type)
     }
     tab[confsize].i_type = type;
 
-    if (type & CONFIG_ITEM)
+    if (CONFIG_ITEM(type))
     {
         module->i_config_items++;
         if (type == CONFIG_ITEM_BOOL)