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 @@
#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]);
}
......
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