Commit 6452698b authored by Laurent Aimar's avatar Laurent Aimar

Added config_ChainDuplicate to duplicate config_chain_t list.

parent 9cef9256
...@@ -278,6 +278,11 @@ VLC_EXPORT( char *, config_ChainCreate, ( char **ppsz_name, config_chain_t **pp_ ...@@ -278,6 +278,11 @@ VLC_EXPORT( char *, config_ChainCreate, ( char **ppsz_name, config_chain_t **pp_
*/ */
VLC_EXPORT( void, config_ChainDestroy, ( config_chain_t * ) ); VLC_EXPORT( void, config_ChainDestroy, ( config_chain_t * ) );
/**
* This function will duplicate a linked list of config_chain_t
*/
VLC_EXPORT( config_chain_t *, config_ChainDuplicate, ( const config_chain_t * ) );
/** /**
* This function will unescape a string in place and will return a pointer on * This function will unescape a string in place and will return a pointer on
* the given string. * the given string.
......
...@@ -412,6 +412,25 @@ void __config_ChainParse( vlc_object_t *p_this, const char *psz_prefix, ...@@ -412,6 +412,25 @@ void __config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
} }
} }
config_chain_t *config_ChainDuplicate( const config_chain_t *p_src )
{
config_chain_t *p_dst = NULL;
config_chain_t **pp_last = &p_dst;
while( p_src )
{
config_chain_t *p = malloc( sizeof(*p) );
if( !p )
break;
p->p_next = NULL;
p->psz_name = p_src->psz_name ? strdup( p_src->psz_name ) : NULL;
p->psz_value = p_src->psz_value ? strdup( p_src->psz_value ) : NULL;
*pp_last = p;
pp_last = &p->p_next;
}
return p_dst;
}
char *config_StringUnescape( char *psz_string ) char *config_StringUnescape( char *psz_string )
{ {
char *psz_src = psz_string; char *psz_src = psz_string;
......
...@@ -51,6 +51,7 @@ block_Realloc ...@@ -51,6 +51,7 @@ block_Realloc
__config_AddIntf __config_AddIntf
config_ChainCreate config_ChainCreate
config_ChainDestroy config_ChainDestroy
config_ChainDuplicate
__config_ChainParse __config_ChainParse
__config_ExistIntf __config_ExistIntf
config_FindConfig config_FindConfig
......
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