Commit 85390818 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

cache: store whether there is a choices callback or not

parent a63f061b
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#ifdef HAVE_DYNAMIC_PLUGINS #ifdef HAVE_DYNAMIC_PLUGINS
/* Sub-version number /* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */ * (only used to avoid breakage in dev version when cache structure changes) */
#define CACHE_SUBVERSION_NUM 20 #define CACHE_SUBVERSION_NUM 21
/* Cache filename */ /* Cache filename */
#define CACHE_NAME "plugins.dat" #define CACHE_NAME "plugins.dat"
...@@ -132,8 +132,8 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file) ...@@ -132,8 +132,8 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
if (cfg->list_count) if (cfg->list_count)
cfg->list.psz = xmalloc (cfg->list_count * sizeof (char *)); cfg->list.psz = xmalloc (cfg->list_count * sizeof (char *));
else else /* TODO: fix config_GetPszChoices() instead of this hack: */
cfg->list.psz_cb = NULL; LOAD_IMMEDIATE(cfg->list.psz_cb);
for (unsigned i = 0; i < cfg->list_count; i++) for (unsigned i = 0; i < cfg->list_count; i++)
LOAD_STRING (cfg->list.psz[i]); LOAD_STRING (cfg->list.psz[i]);
} }
...@@ -146,8 +146,8 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file) ...@@ -146,8 +146,8 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
if (cfg->list_count) if (cfg->list_count)
cfg->list.i = xmalloc (cfg->list_count * sizeof (int)); cfg->list.i = xmalloc (cfg->list_count * sizeof (int));
else else /* TODO: fix config_GetPszChoices() instead of this hack: */
cfg->list.i_cb = NULL; LOAD_IMMEDIATE(cfg->list.i_cb);
for (unsigned i = 0; i < cfg->list_count; i++) for (unsigned i = 0; i < cfg->list_count; i++)
LOAD_IMMEDIATE (cfg->list.i[i]); LOAD_IMMEDIATE (cfg->list.i[i]);
} }
...@@ -403,6 +403,8 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg) ...@@ -403,6 +403,8 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg)
if (IsConfigStringType (cfg->i_type)) if (IsConfigStringType (cfg->i_type))
{ {
SAVE_STRING (cfg->orig.psz); 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++) for (unsigned i = 0; i < cfg->list_count; i++)
SAVE_STRING (cfg->list.psz[i]); SAVE_STRING (cfg->list.psz[i]);
} }
...@@ -411,6 +413,8 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg) ...@@ -411,6 +413,8 @@ static int CacheSaveConfig (FILE *file, const module_config_t *cfg)
SAVE_IMMEDIATE (cfg->orig); SAVE_IMMEDIATE (cfg->orig);
SAVE_IMMEDIATE (cfg->min); SAVE_IMMEDIATE (cfg->min);
SAVE_IMMEDIATE (cfg->max); 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++) for (unsigned i = 0; i < cfg->list_count; i++)
SAVE_IMMEDIATE (cfg->list.i[i]); SAVE_IMMEDIATE (cfg->list.i[i]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment