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
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
Show 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
...
@@ -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
*
);
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 )
#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
* This function will parse a configuration string (psz_string) and
* - set the module name (*ppsz_name)
* - set the module name (*ppsz_name)
...
...
src/config/chain.c
View file @
f6533ac0
...
@@ -175,36 +175,21 @@ static char *ChainGetValue( const char **ppsz_string )
...
@@ -175,36 +175,21 @@ static char *ChainGetValue( const char **ppsz_string )
return
psz_value
;
return
psz_value
;
}
}
char
*
config_ChainCreate
(
char
**
ppsz_name
,
config_chain_t
**
pp_cfg
,
/* Parse all name=value[,] elements */
const
char
*
psz_chain
)
const
char
*
config_ChainParseOptions
(
config_chain_t
**
pp_cfg
,
const
char
*
psz_opts
)
{
{
config_chain_t
**
pp_next
=
pp_cfg
;
config_chain_t
**
pp_next
=
pp_cfg
;
size_t
len
;
bool
first
=
true
;
*
ppsz_name
=
NULL
;
*
pp_cfg
=
NULL
;
if
(
!
psz_chain
)
return
NULL
;
SKIPSPACE
(
psz_chain
);
/* Look for parameter (a {...} or :...) or end of name (space or nul) */
len
=
strcspn
(
psz_chain
,
"{:
\t
"
);
*
ppsz_name
=
strndup
(
psz_chain
,
len
);
psz_chain
+=
len
;
/* Parse the parameters */
SKIPSPACE
(
psz_chain
);
if
(
*
psz_chain
==
'{'
)
{
/* Parse all name=value[,] elements */
do
do
{
{
psz_chain
++
;
/* skip previous delimiter */
if
(
!
first
)
SKIPSPACE
(
psz_chain
);
psz_opts
++
;
/* skip previous delimiter */
SKIPSPACE
(
psz_opts
);
first
=
false
;
/* Look for the end of the name (,={}_space_) */
/* Look for the end of the name (,={}_space_) */
len
=
strcspn
(
psz_chain
,
"=,{}
\t
"
);
size_t
len
=
strcspn
(
psz_opts
,
"=,{}
\t
"
);
if
(
len
==
0
)
if
(
len
==
0
)
continue
;
/* ignore empty parameter */
continue
;
/* ignore empty parameter */
...
@@ -212,8 +197,8 @@ char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg,
...
@@ -212,8 +197,8 @@ char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg,
config_chain_t
*
p_cfg
=
malloc
(
sizeof
(
*
p_cfg
)
);
config_chain_t
*
p_cfg
=
malloc
(
sizeof
(
*
p_cfg
)
);
if
(
!
p_cfg
)
if
(
!
p_cfg
)
break
;
break
;
p_cfg
->
psz_name
=
strndup
(
psz_chain
,
len
);
p_cfg
->
psz_name
=
strndup
(
psz_opts
,
len
);
psz_chain
+=
len
;
psz_opts
+=
len
;
p_cfg
->
psz_value
=
NULL
;
p_cfg
->
psz_value
=
NULL
;
p_cfg
->
p_next
=
NULL
;
p_cfg
->
p_next
=
NULL
;
...
@@ -221,18 +206,42 @@ char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg,
...
@@ -221,18 +206,42 @@ char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg,
pp_next
=
&
p_cfg
->
p_next
;
pp_next
=
&
p_cfg
->
p_next
;
/* Extract the option value */
/* Extract the option value */
SKIPSPACE
(
psz_chain
);
SKIPSPACE
(
psz_opts
);
if
(
strchr
(
"={"
,
*
psz_chain
)
)
if
(
strchr
(
"={"
,
*
psz_opts
)
)
{
{
p_cfg
->
psz_value
=
ChainGetValue
(
&
psz_chain
);
p_cfg
->
psz_value
=
ChainGetValue
(
&
psz_opts
);
SKIPSPACE
(
psz_chain
);
SKIPSPACE
(
psz_opts
);
}
}
}
}
while
(
!
memchr
(
"}"
,
*
psz_chain
,
2
)
);
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
)
{
size_t
len
;
*
ppsz_name
=
NULL
;
*
pp_cfg
=
NULL
;
if
(
*
psz_chain
)
psz_chain
++
;
/* skip '}' */
;
if
(
!
psz_chain
)
return
NULL
;
SKIPSPACE
(
psz_chain
);
SKIPSPACE
(
psz_chain
);
}
/* Look for parameter (a {...} or :...) or end of name (space or nul) */
len
=
strcspn
(
psz_chain
,
"{:
\t
"
);
*
ppsz_name
=
strndup
(
psz_chain
,
len
);
psz_chain
+=
len
;
/* Parse the parameters */
SKIPSPACE
(
psz_chain
);
if
(
*
psz_chain
==
'{'
)
psz_chain
=
config_ChainParseOptions
(
pp_cfg
,
psz_chain
);
if
(
*
psz_chain
==
':'
)
if
(
*
psz_chain
==
':'
)
return
strdup
(
psz_chain
+
1
);
return
strdup
(
psz_chain
+
1
);
...
...
src/libvlccore.sym
View file @
f6533ac0
...
@@ -54,6 +54,7 @@ config_ChainCreate
...
@@ -54,6 +54,7 @@ config_ChainCreate
config_ChainDestroy
config_ChainDestroy
config_ChainDuplicate
config_ChainDuplicate
config_ChainParse
config_ChainParse
config_ChainParseOptions
config_ExistIntf
config_ExistIntf
config_FindConfig
config_FindConfig
config_GetConfDir
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