[vlc-devel] commit: Added config_ChainDuplicate to duplicate config_chain_t list. ( Laurent Aimar )
git version control
git at videolan.org
Sun May 31 17:37:55 CEST 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun May 31 17:28:20 2009 +0200| [6452698b9a24b07df260464c6f5eb635b0d2e4d9] | committer: Laurent Aimar
Added config_ChainDuplicate to duplicate config_chain_t list.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6452698b9a24b07df260464c6f5eb635b0d2e4d9
---
include/vlc_configuration.h | 5 +++++
src/config/chain.c | 19 +++++++++++++++++++
src/libvlccore.sym | 1 +
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index 5ccb29e..1c2c48f 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -279,6 +279,11 @@ VLC_EXPORT( char *, config_ChainCreate, ( char **ppsz_name, config_chain_t **pp_
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
* the given string.
* No memory is allocated by it (unlike config_StringEscape).
diff --git a/src/config/chain.c b/src/config/chain.c
index 3122c48..88ad283 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -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 *psz_src = psz_string;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 48f0a32..239ff76 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -51,6 +51,7 @@ block_Realloc
__config_AddIntf
config_ChainCreate
config_ChainDestroy
+config_ChainDuplicate
__config_ChainParse
__config_ExistIntf
config_FindConfig
More information about the vlc-devel
mailing list