Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d70cda88
Commit
d70cda88
authored
Aug 15, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modules: simplify storage of choices in cache
parent
2f3f0899
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
57 deletions
+27
-57
src/modules/cache.c
src/modules/cache.c
+27
-57
No files found.
src/modules/cache.c
View file @
d70cda88
...
...
@@ -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 1
8
#define CACHE_SUBVERSION_NUM 1
9
/* Cache filename */
#define CACHE_NAME "plugins.dat"
...
...
@@ -321,49 +321,27 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
p_module
->
p_config
[
i
].
value
.
psz
=
(
p_module
->
p_config
[
i
].
orig
.
psz
!=
NULL
)
?
strdup
(
p_module
->
p_config
[
i
].
orig
.
psz
)
:
NULL
;
p_module
->
p_config
[
i
].
ppsz_list
=
xmalloc
(
p_module
->
p_config
[
i
].
i_list
*
sizeof
(
char
*
)
);
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
LOAD_STRING
(
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
);
}
else
{
memcpy
(
&
p_module
->
p_config
[
i
].
value
,
&
p_module
->
p_config
[
i
].
orig
,
sizeof
(
p_module
->
p_config
[
i
].
value
));
if
(
p_module
->
p_config
[
i
].
i_list
)
{
if
(
p_module
->
p_config
[
i
].
ppsz_list
)
{
p_module
->
p_config
[
i
].
ppsz_list
=
xmalloc
(
(
p_module
->
p_config
[
i
].
i_list
+
1
)
*
sizeof
(
char
*
));
if
(
p_module
->
p_config
[
i
].
ppsz_list
)
{
int
j
;
for
(
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
LOAD_STRING
(
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
);
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
=
NULL
;
}
}
if
(
p_module
->
p_config
[
i
].
ppsz_list_text
)
{
p_module
->
p_config
[
i
].
ppsz_list_text
=
xmalloc
(
(
p_module
->
p_config
[
i
].
i_list
+
1
)
*
sizeof
(
char
*
));
if
(
p_module
->
p_config
[
i
].
ppsz_list_text
)
{
int
j
;
for
(
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
LOAD_STRING
(
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
);
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
=
NULL
;
}
}
if
(
p_module
->
p_config
[
i
].
pi_list
)
{
p_module
->
p_config
[
i
].
pi_list
=
xmalloc
(
(
p_module
->
p_config
[
i
].
i_list
+
1
)
*
sizeof
(
int
)
);
if
(
p_module
->
p_config
[
i
].
pi_list
)
{
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
LOAD_IMMEDIATE
(
p_module
->
p_config
[
i
].
pi_list
[
j
]
);
}
}
p_module
->
p_config
[
i
].
pi_list
=
xmalloc
(
p_module
->
p_config
[
i
].
i_list
*
sizeof
(
int
)
);
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
LOAD_IMMEDIATE
(
p_module
->
p_config
[
i
].
pi_list
[
j
]
);
}
p_module
->
p_config
[
i
].
ppsz_list_text
=
xmalloc
(
p_module
->
p_config
[
i
].
i_list
*
sizeof
(
char
*
)
);
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
LOAD_STRING
(
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
);
if
(
p_module
->
p_config
[
i
].
i_action
)
{
p_module
->
p_config
[
i
].
ppf_action
=
...
...
@@ -468,7 +446,7 @@ static int CacheSaveBank (FILE *file, const module_cache_t *cache,
goto
error
;
#define SAVE_IMMEDIATE( a ) \
if (fwrite (&
a
, sizeof(a), 1, file) != 1) \
if (fwrite (&
(a)
, sizeof(a), 1, file) != 1) \
goto error
#define SAVE_STRING( a ) \
{ \
...
...
@@ -560,28 +538,20 @@ static int CacheSaveConfig (FILE *file, const module_t *p_module)
SAVE_STRING
(
p_module
->
p_config
[
i
].
psz_longtext
);
if
(
IsConfigStringType
(
p_module
->
p_config
[
i
].
i_type
))
{
SAVE_STRING
(
p_module
->
p_config
[
i
].
orig
.
psz
);
if
(
p_module
->
p_config
[
i
].
i_list
)
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
SAVE_STRING
(
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
);
}
else
{
if
(
p_module
->
p_config
[
i
].
ppsz_list
)
{
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
SAVE_STRING
(
p_module
->
p_config
[
i
].
ppsz_list
[
j
]
);
}
if
(
p_module
->
p_config
[
i
].
ppsz_list_text
)
{
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
SAVE_STRING
(
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
);
}
if
(
p_module
->
p_config
[
i
].
pi_list
)
{
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
SAVE_IMMEDIATE
(
p_module
->
p_config
[
i
].
pi_list
[
j
]
);
}
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
SAVE_IMMEDIATE
(
p_module
->
p_config
[
i
].
pi_list
[
j
]
);
}
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_list
;
j
++
)
SAVE_STRING
(
p_module
->
p_config
[
i
].
ppsz_list_text
[
j
]
);
for
(
int
j
=
0
;
j
<
p_module
->
p_config
[
i
].
i_action
;
j
++
)
SAVE_STRING
(
p_module
->
p_config
[
i
].
ppsz_action_text
[
j
]
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment