Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
f6533ac0
Commit
f6533ac0
authored
Mar 14, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split options parsing from config_ChainCreate
parent
22c24d5a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
38 deletions
+60
-38
include/vlc_configuration.h
include/vlc_configuration.h
+12
-0
src/config/chain.c
src/config/chain.c
+47
-38
src/libvlccore.sym
src/libvlccore.sym
+1
-0
No files found.
include/vlc_configuration.h
View file @
f6533ac0
...
...
@@ -255,6 +255,18 @@ struct config_chain_t
VLC_API
void
config_ChainParse
(
vlc_object_t
*
,
const
char
*
psz_prefix
,
const
char
*
const
*
ppsz_options
,
config_chain_t
*
);
#define config_ChainParse( a, b, c, d ) config_ChainParse( VLC_OBJECT(a), b, c, d )
/**
* This function will parse a configuration string (psz_opts) and
* - set all options for this module in a chained list (*pp_cfg)
* - returns a pointer on the next module if any.
*
* The string format is
* module{option=*,option=*}
*
* The options values are unescaped using config_StringUnescape.
*/
VLC_API
const
char
*
config_ChainParseOptions
(
config_chain_t
**
pp_cfg
,
const
char
*
ppsz_opts
);
/**
* This function will parse a configuration string (psz_string) and
* - set the module name (*ppsz_name)
...
...
src/config/chain.c
View file @
f6533ac0
...
...
@@ -175,10 +175,55 @@ static char *ChainGetValue( const char **ppsz_string )
return
psz_value
;
}
/* Parse all name=value[,] elements */
const
char
*
config_ChainParseOptions
(
config_chain_t
**
pp_cfg
,
const
char
*
psz_opts
)
{
config_chain_t
**
pp_next
=
pp_cfg
;
bool
first
=
true
;
do
{
if
(
!
first
)
psz_opts
++
;
/* skip previous delimiter */
SKIPSPACE
(
psz_opts
);
first
=
false
;
/* Look for the end of the name (,={}_space_) */
size_t
len
=
strcspn
(
psz_opts
,
"=,{}
\t
"
);
if
(
len
==
0
)
continue
;
/* ignore empty parameter */
/* Append the new parameter */
config_chain_t
*
p_cfg
=
malloc
(
sizeof
(
*
p_cfg
)
);
if
(
!
p_cfg
)
break
;
p_cfg
->
psz_name
=
strndup
(
psz_opts
,
len
);
psz_opts
+=
len
;
p_cfg
->
psz_value
=
NULL
;
p_cfg
->
p_next
=
NULL
;
*
pp_next
=
p_cfg
;
pp_next
=
&
p_cfg
->
p_next
;
/* Extract the option value */
SKIPSPACE
(
psz_opts
);
if
(
strchr
(
"={"
,
*
psz_opts
)
)
{
p_cfg
->
psz_value
=
ChainGetValue
(
&
psz_opts
);
SKIPSPACE
(
psz_opts
);
}
}
while
(
!
memchr
(
"}"
,
*
psz_opts
,
2
)
);
if
(
*
psz_opts
)
psz_opts
++
;
/* skip '}' */
;
SKIPSPACE
(
psz_opts
);
return
psz_opts
;
}
char
*
config_ChainCreate
(
char
**
ppsz_name
,
config_chain_t
**
pp_cfg
,
const
char
*
psz_chain
)
{
config_chain_t
**
pp_next
=
pp_cfg
;
size_t
len
;
*
ppsz_name
=
NULL
;
...
...
@@ -196,43 +241,7 @@ char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg,
/* Parse the parameters */
SKIPSPACE
(
psz_chain
);
if
(
*
psz_chain
==
'{'
)
{
/* Parse all name=value[,] elements */
do
{
psz_chain
++
;
/* skip previous delimiter */
SKIPSPACE
(
psz_chain
);
/* Look for the end of the name (,={}_space_) */
len
=
strcspn
(
psz_chain
,
"=,{}
\t
"
);
if
(
len
==
0
)
continue
;
/* ignore empty parameter */
/* Append the new parameter */
config_chain_t
*
p_cfg
=
malloc
(
sizeof
(
*
p_cfg
)
);
if
(
!
p_cfg
)
break
;
p_cfg
->
psz_name
=
strndup
(
psz_chain
,
len
);
psz_chain
+=
len
;
p_cfg
->
psz_value
=
NULL
;
p_cfg
->
p_next
=
NULL
;
*
pp_next
=
p_cfg
;
pp_next
=
&
p_cfg
->
p_next
;
/* Extract the option value */
SKIPSPACE
(
psz_chain
);
if
(
strchr
(
"={"
,
*
psz_chain
)
)
{
p_cfg
->
psz_value
=
ChainGetValue
(
&
psz_chain
);
SKIPSPACE
(
psz_chain
);
}
}
while
(
!
memchr
(
"}"
,
*
psz_chain
,
2
)
);
if
(
*
psz_chain
)
psz_chain
++
;
/* skip '}' */
;
SKIPSPACE
(
psz_chain
);
}
psz_chain
=
config_ChainParseOptions
(
pp_cfg
,
psz_chain
);
if
(
*
psz_chain
==
':'
)
return
strdup
(
psz_chain
+
1
);
...
...
src/libvlccore.sym
View file @
f6533ac0
...
...
@@ -54,6 +54,7 @@ config_ChainCreate
config_ChainDestroy
config_ChainDuplicate
config_ChainParse
config_ChainParseOptions
config_ExistIntf
config_FindConfig
config_GetConfDir
...
...
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