[vlc-commits] config_GetType(): remove unused parameter

Rémi Denis-Courmont git at videolan.org
Tue Jul 25 17:51:42 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 25 18:37:08 2017 +0300| [880d0f652ee6055e3d6b0a0f4692a503698306d3] | committer: Rémi Denis-Courmont

config_GetType(): remove unused parameter

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

 include/vlc_configuration.h                        |  3 +-
 modules/gui/macosx/VLCCoreInteraction.m            |  2 +-
 .../gui/macosx/VLCVideoEffectsWindowController.m   |  2 +-
 modules/gui/qt/components/extended_panels.cpp      |  4 +--
 modules/lua/libs/configuration.c                   |  4 +--
 modules/lua/libs/variables.c                       |  2 +-
 src/config/chain.c                                 |  4 +--
 src/config/core.c                                  | 40 +++++++---------------
 src/misc/variables.c                               |  4 +--
 9 files changed, 24 insertions(+), 41 deletions(-)

diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index 6454dedac6..209168615b 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -95,7 +95,7 @@ struct module_config_t
  * Prototypes - these methods are used to get, set or manipulate configuration
  * data.
  *****************************************************************************/
-VLC_API int config_GetType(vlc_object_t *, const char *) VLC_USED;
+VLC_API int config_GetType(const char *) VLC_USED;
 VLC_API int64_t config_GetInt(vlc_object_t *, const char *) VLC_USED;
 VLC_API void config_PutInt(vlc_object_t *, const char *, int64_t);
 VLC_API float config_GetFloat(vlc_object_t *, const char *) VLC_USED;
@@ -140,7 +140,6 @@ VLC_API void config_AddIntf( vlc_object_t *, const char * );
 VLC_API void config_RemoveIntf( vlc_object_t *, const char * );
 VLC_API bool config_ExistIntf( vlc_object_t *, const char * ) VLC_USED;
 
-#define config_GetType(a,b) config_GetType(VLC_OBJECT(a),b)
 #define config_GetInt(a,b) config_GetInt(VLC_OBJECT(a),b)
 #define config_PutInt(a,b,c) config_PutInt(VLC_OBJECT(a),b,c)
 #define config_GetFloat(a,b) config_GetFloat(VLC_OBJECT(a),b)
diff --git a/modules/gui/macosx/VLCCoreInteraction.m b/modules/gui/macosx/VLCCoreInteraction.m
index 43ab03a477..3f0ab75cf3 100644
--- a/modules/gui/macosx/VLCCoreInteraction.m
+++ b/modules/gui/macosx/VLCCoreInteraction.m
@@ -816,7 +816,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         b_is_command = i_type & VLC_VAR_ISCOMMAND;
     }
     if (!i_type)
-        i_type = config_GetType(p_intf, psz_property);
+        i_type = config_GetType(psz_property);
 
     i_type &= VLC_VAR_CLASS;
     if (i_type == VLC_VAR_BOOL)
diff --git a/modules/gui/macosx/VLCVideoEffectsWindowController.m b/modules/gui/macosx/VLCVideoEffectsWindowController.m
index 45f160aa5d..539e2143f5 100644
--- a/modules/gui/macosx/VLCVideoEffectsWindowController.m
+++ b/modules/gui/macosx/VLCVideoEffectsWindowController.m
@@ -378,7 +378,7 @@
     playlist_t *p_playlist = pl_Get(p_intf);
 
     vlc_value_t val;
-    int i_type = config_GetType(p_intf, psz_option) & VLC_VAR_CLASS;
+    int i_type = config_GetType(psz_option) & VLC_VAR_CLASS;
     switch (i_type)
     {
     case VLC_VAR_BOOL:
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index d8620249a9..9938a39421 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -424,7 +424,7 @@ void ExtVideo::setWidgetValue( QObject *widget )
     //std::cout << "Option name: " << option.toStdString() << std::endl;
 
     vlc_value_t val;
-    int i_type = config_GetType( p_intf, qtu( option ) ) & VLC_VAR_CLASS;
+    int i_type = config_GetType( qtu( option ) ) & VLC_VAR_CLASS;
     switch( i_type )
     {
         case VLC_VAR_INTEGER:
@@ -500,7 +500,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option,
         b_is_command = ( i_type & VLC_VAR_ISCOMMAND );
     }
     if( i_type == 0 )
-        i_type = config_GetType( p_intf, psz_option );
+        i_type = config_GetType( psz_option );
 
     vlc_value_t val;
     i_type &= VLC_VAR_CLASS;
diff --git a/modules/lua/libs/configuration.c b/modules/lua/libs/configuration.c
index 330847cbcf..bbb200527c 100644
--- a/modules/lua/libs/configuration.c
+++ b/modules/lua/libs/configuration.c
@@ -44,7 +44,7 @@ static int vlclua_config_get( lua_State *L )
 {
     vlc_object_t * p_this = vlclua_get_this( L );
     const char *psz_name = luaL_checkstring( L, 1 );
-    switch( config_GetType( p_this, psz_name ) )
+    switch( config_GetType( psz_name ) )
     {
         case VLC_VAR_STRING:
         {
@@ -77,7 +77,7 @@ static int vlclua_config_set( lua_State *L )
 {
     vlc_object_t *p_this = vlclua_get_this( L );
     const char *psz_name = luaL_checkstring( L, 1 );
-    switch( config_GetType( p_this, psz_name ) )
+    switch( config_GetType( psz_name ) )
     {
         case VLC_VAR_STRING:
             config_PutPsz( p_this, psz_name, luaL_checkstring( L, 2 ) );
diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index 300e1811f4..76e4290f13 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -154,7 +154,7 @@ static int vlclua_var_inherit( lua_State *L )
     }
     const char *psz_var = luaL_checkstring( L, 2 );
 
-    int i_type = config_GetType( p_obj, psz_var );
+    int i_type = config_GetType( psz_var );
     if( var_Inherit( p_obj, psz_var, i_type, &val ) != VLC_SUCCESS )
         return 0;
 
diff --git a/src/config/chain.c b/src/config/chain.c
index 45c46395ae..2cfc58f640 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -284,7 +284,7 @@ void config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
         char name[plen + strlen( optname )];
         snprintf( name, sizeof (name), "%s%s", psz_prefix, optname );
         if( var_Create( p_this, name,
-                        config_GetType( p_this, name ) | VLC_VAR_DOINHERIT ) )
+                        config_GetType( name ) | VLC_VAR_DOINHERIT ) )
             return /* VLC_xxx */;
 
         module_config_t* p_conf = config_FindConfig( name );
@@ -375,7 +375,7 @@ void config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
         /* </Check if the option is deprecated> */
 
         /* get the type of the variable */
-        i_type = config_GetType( p_this, psz_name );
+        i_type = config_GetType( psz_name );
         if( !i_type )
         {
             msg_Warn( p_this, "unknown option %s (value=%s)",
diff --git a/src/config/core.c b/src/config/core.c
index 28397c25b8..296cc37a00 100644
--- a/src/config/core.c
+++ b/src/config/core.c
@@ -46,19 +46,14 @@ static inline char *strdupnull (const char *src)
     return src ? strdup (src) : NULL;
 }
 
-#undef config_GetType
 /*****************************************************************************
  * config_GetType: get the type of a variable (bool, int, float, string)
  *****************************************************************************
  * This function is used to get the type of a variable from its name.
- * Beware, this is quite slow.
  *****************************************************************************/
-int config_GetType( vlc_object_t *p_this, const char *psz_name )
+int config_GetType(const char *psz_name)
 {
-    module_config_t *p_config;
-    int i_type;
-
-    p_config = config_FindConfig( psz_name );
+    module_config_t *p_config = config_FindConfig(psz_name);
 
     /* sanity checks */
     if( !p_config )
@@ -68,28 +63,17 @@ int config_GetType( vlc_object_t *p_this, const char *psz_name )
 
     switch( CONFIG_CLASS(p_config->i_type) )
     {
-    case CONFIG_ITEM_FLOAT:
-        i_type = VLC_VAR_FLOAT;
-        break;
-
-    case CONFIG_ITEM_INTEGER:
-        i_type = VLC_VAR_INTEGER;
-        break;
-
-    case CONFIG_ITEM_BOOL:
-        i_type = VLC_VAR_BOOL;
-        break;
-
-    case CONFIG_ITEM_STRING:
-        i_type = VLC_VAR_STRING;
-        break;
-
-    default:
-        i_type = 0;
-        break;
+        case CONFIG_ITEM_FLOAT:
+            return VLC_VAR_FLOAT;
+        case CONFIG_ITEM_INTEGER:
+            return VLC_VAR_INTEGER;
+        case CONFIG_ITEM_BOOL:
+            return VLC_VAR_BOOL;
+        case CONFIG_ITEM_STRING:
+            return VLC_VAR_STRING;
+        default:
+            return 0;
     }
-
-    return i_type;
 }
 
 bool config_IsSafe( const char *name )
diff --git a/src/misc/variables.c b/src/misc/variables.c
index d441684c06..4457fe747d 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1054,7 +1054,7 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
     if( psz_value != NULL )
         *psz_value++ = '\0';
 
-    i_type = config_GetType( p_obj, psz_name );
+    i_type = config_GetType( psz_name );
     if( !i_type && !psz_value )
     {
         /* check for "no-foo" or "nofoo" */
@@ -1069,7 +1069,7 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
         else goto cleanup;           /* Option doesn't exist */
 
         b_isno = true;
-        i_type = config_GetType( p_obj, psz_name );
+        i_type = config_GetType( psz_name );
     }
     if( !i_type ) goto cleanup; /* Option doesn't exist */
 



More information about the vlc-commits mailing list