[vlc-commits] commit: Remove config change callback ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Fri Oct 22 19:02:25 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct 22 19:45:36 2010 +0300| [3c659c5390193503df2258a5233911633910bd65] | committer: Rémi Denis-Courmont 

Remove config change callback

This was only used by {alsa,oss}-audio-device and not semantically
correct anyway. If we deem that this is useful, we should register
a callback on the corresponding variables and change the variables
from the UI, not the process-wide configuration.

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

 include/vlc_configuration.h |    3 --
 include/vlc_plugin.h        |    2 +-
 src/config/core.c           |   44 ++----------------------------------------
 src/modules/cache.c         |   20 +------------------
 src/modules/entry.c         |    2 -
 src/modules/modules.c       |    2 +-
 6 files changed, 6 insertions(+), 67 deletions(-)

diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index 96a0792..79e2eaf 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -155,9 +155,6 @@ struct module_config_t
     module_value_t min;
     module_value_t max;
 
-    /* Function to call when commiting a change */
-    vlc_callback_t pf_callback;
-
     /* Values list */
     char **      ppsz_list;       /* List of possible values for the option */
     int         *pi_list;                              /* Idem for integers */
diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index 7c1b343..3fba17b 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -58,7 +58,7 @@ enum vlc_module_properties
     /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI!
      * Append new items at the end ONLY. */
     VLC_CONFIG_NAME=0x1000,
-    /* command line name (args=const char *, vlc_callback_t) */
+    /* command line name (args=const char *) */
 
     VLC_CONFIG_VALUE,
     /* actual value (args=int/double/const char *) */
diff --git a/src/config/core.c b/src/config/core.c
index 255df83..02aded0 100644
--- a/src/config/core.c
+++ b/src/config/core.c
@@ -257,7 +257,6 @@ void config_PutPsz( vlc_object_t *p_this,
                       const char *psz_name, const char *psz_value )
 {
     module_config_t *p_config;
-    vlc_value_t oldval;
 
     p_config = config_FindConfig( p_this, psz_name );
 
@@ -275,30 +274,19 @@ void config_PutPsz( vlc_object_t *p_this,
         return;
     }
 
-    char *str;
+    char *str, *oldstr;
     if ((psz_value != NULL) && *psz_value)
         str = strdup (psz_value);
     else
         str = NULL;
 
     vlc_rwlock_wrlock (&config_lock);
-    /* backup old value */
-    oldval.psz_string = (char *)p_config->value.psz;
-
+    oldstr = (char *)p_config->value.psz;
     p_config->value.psz = str;
     p_config->b_dirty = true;
     vlc_rwlock_unlock (&config_lock);
 
-    if( p_config->pf_callback )
-    {
-        vlc_value_t val;
-
-        val.psz_string = (char *)psz_value;
-        p_config->pf_callback( p_this, psz_name, oldval, val, NULL );
-    }
-
-    /* free old string */
-    free( oldval.psz_string );
+    free (oldstr);
 }
 
 #undef config_PutInt
@@ -313,7 +301,6 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
                     int64_t i_value )
 {
     module_config_t *p_config;
-    vlc_value_t oldval;
 
     p_config = config_FindConfig( p_this, psz_name );
 
@@ -336,21 +323,9 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
         i_value = p_config->max.i;
 
     vlc_rwlock_wrlock (&config_lock);
-    /* backup old value */
-    oldval.i_int = p_config->value.i;
-
     p_config->value.i = i_value;
     p_config->b_dirty = true;
     vlc_rwlock_unlock (&config_lock);
-
-    if( p_config->pf_callback )
-    {
-        vlc_value_t val;
-
-        val.i_int = i_value;
-        p_config->pf_callback( p_this, psz_name, oldval, val,
-                               p_config->p_callback_data );
-    }
 }
 
 #undef config_PutFloat
@@ -364,7 +339,6 @@ void config_PutFloat( vlc_object_t *p_this,
                       const char *psz_name, float f_value )
 {
     module_config_t *p_config;
-    vlc_value_t oldval;
 
     p_config = config_FindConfig( p_this, psz_name );
 
@@ -390,21 +364,9 @@ void config_PutFloat( vlc_object_t *p_this,
         f_value = p_config->max.f;
 
     vlc_rwlock_wrlock (&config_lock);
-    /* backup old value */
-    oldval.f_float = p_config->value.f;
-
     p_config->value.f = f_value;
     p_config->b_dirty = true;
     vlc_rwlock_unlock (&config_lock);
-
-    if( p_config->pf_callback )
-    {
-        vlc_value_t val;
-
-        val.f_float = f_value;
-        p_config->pf_callback( p_this, psz_name, oldval, val,
-                               p_config->p_callback_data );
-    }
 }
 
 static int confcmp (const void *a, const void *b)
diff --git a/src/modules/cache.c b/src/modules/cache.c
index 3f09ad8..76de0b8 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -59,7 +59,7 @@ static int    CacheLoadConfig  ( module_t *, FILE * );
 
 /* Sub-version number
  * (only used to avoid breakage in dev version when cache structure changes) */
-#define CACHE_SUBVERSION_NUM 11
+#define CACHE_SUBVERSION_NUM 12
 
 /* Format string for the cache filename */
 #define CACHENAME_FORMAT \
@@ -326,16 +326,6 @@ void CacheLoad( vlc_object_t *p_this, module_bank_t *p_bank, const char *dir )
 }
 
 
-/* This function should never be called.
- * It is only used as a non-NULL vlc_callback_t value for comparison. */
-static int dummy_callback (vlc_object_t *obj, const char *name,
-                           vlc_value_t oldval, vlc_value_t newval, void *data)
-{
-    (void) obj; (void)name; (void)oldval; (void)newval; (void)data;
-    assert (0);
-}
-
-
 static int CacheLoadConfig( module_t *p_module, FILE *file )
 {
     uint32_t i_lines;
@@ -441,11 +431,6 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
                 LOAD_STRING( p_module->p_config[i].ppsz_action_text[j] );
             }
         }
-
-        bool has_callback;
-        LOAD_IMMEDIATE( has_callback );
-        if (has_callback)
-            p_module->p_config[i].pf_callback = dummy_callback;
     }
 
     return VLC_SUCCESS;
@@ -669,9 +654,6 @@ static int CacheSaveConfig (FILE *file, const module_t *p_module)
 
         for (int j = 0; j < p_module->p_config[i].i_action; j++)
             SAVE_STRING( p_module->p_config[i].ppsz_action_text[j] );
-
-        bool has_callback = p_module->p_config[i].pf_callback != NULL;
-        SAVE_IMMEDIATE( has_callback );
     }
     return 0;
 
diff --git a/src/modules/entry.c b/src/modules/entry.c
index a14caed..42f8449 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -259,11 +259,9 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
         case VLC_CONFIG_NAME:
         {
             const char *name = va_arg (ap, const char *);
-            vlc_callback_t cb = va_arg (ap, vlc_callback_t);
 
             assert (name != NULL);
             item->psz_name = strdup (name);
-            item->pf_callback = cb;
             break;
         }
 
diff --git a/src/modules/modules.c b/src/modules/modules.c
index c5e2c4f..58181cb 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -956,7 +956,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
         for( p_item = p_module->p_config, p_end = p_item + p_module->confsize;
              p_item < p_end; p_item++ )
         {
-            if( p_item->pf_callback || p_item->i_action )
+            if( p_item->i_action )
             {
                 p_module = AllocatePlugin( p_this, psz_file );
                 break;



More information about the vlc-commits mailing list