[vlc-commits] cache: store whether there is a choices callback or not

Rémi Denis-Courmont git at videolan.org
Sat Jan 19 09:45:34 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 19 10:45:04 2013 +0200| [85390818f8fc565e7606a9b201bc6aa313d9f85d] | committer: Rémi Denis-Courmont

cache: store whether there is a choices callback or not

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

 src/modules/cache.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/modules/cache.c b/src/modules/cache.c
index 9d83632..97e4201 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -57,7 +57,7 @@
 #ifdef HAVE_DYNAMIC_PLUGINS
 /* Sub-version number
  * (only used to avoid breakage in dev version when cache structure changes) */
-#define CACHE_SUBVERSION_NUM 20
+#define CACHE_SUBVERSION_NUM 21
 
 /* Cache filename */
 #define CACHE_NAME "plugins.dat"
@@ -132,8 +132,8 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
 
         if (cfg->list_count)
             cfg->list.psz = xmalloc (cfg->list_count * sizeof (char *));
-        else
-            cfg->list.psz_cb = NULL;
+        else /* TODO: fix config_GetPszChoices() instead of this hack: */
+            LOAD_IMMEDIATE(cfg->list.psz_cb);
         for (unsigned i = 0; i < cfg->list_count; i++)
             LOAD_STRING (cfg->list.psz[i]);
     }
@@ -146,8 +146,8 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
 
         if (cfg->list_count)
             cfg->list.i = xmalloc (cfg->list_count * sizeof (int));
-        else
-            cfg->list.i_cb = NULL;
+        else /* TODO: fix config_GetPszChoices() instead of this hack: */
+            LOAD_IMMEDIATE(cfg->list.i_cb);
         for (unsigned i = 0; i < cfg->list_count; i++)
              LOAD_IMMEDIATE (cfg->list.i[i]);
     }
@@ -403,6 +403,8 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg)
     if (IsConfigStringType (cfg->i_type))
     {
         SAVE_STRING (cfg->orig.psz);
+        if (cfg->list_count == 0)
+            SAVE_IMMEDIATE (cfg->list.psz_cb); /* XXX: see CacheLoadConfig() */
         for (unsigned i = 0; i < cfg->list_count; i++)
             SAVE_STRING (cfg->list.psz[i]);
     }
@@ -411,6 +413,8 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg)
         SAVE_IMMEDIATE (cfg->orig);
         SAVE_IMMEDIATE (cfg->min);
         SAVE_IMMEDIATE (cfg->max);
+        if (cfg->list_count == 0)
+            SAVE_IMMEDIATE (cfg->list.i_cb); /* XXX: see CacheLoadConfig() */
         for (unsigned i = 0; i < cfg->list_count; i++)
              SAVE_IMMEDIATE (cfg->list.i[i]);
     }



More information about the vlc-commits mailing list