]> git.sesse.net Git - vlc/commitdiff
Added config_ChainDuplicate to duplicate config_chain_t list.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 31 May 2009 15:28:20 +0000 (17:28 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 31 May 2009 15:31:53 +0000 (17:31 +0200)
include/vlc_configuration.h
src/config/chain.c
src/libvlccore.sym

index 5ccb29e3c6a9650f2ef106761e7fd1a9bc74b337..1c2c48fe1cdbeef1b3b5ad9687f58fcf9338d0dc 100644 (file)
@@ -278,6 +278,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.
index 3122c48702cae487a6f4ce2fd66aebf5f8d47453..88ad2831a075bb03b96aaf5122f455d571e078ad 100644 (file)
@@ -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;
index 48f0a321b54f80b8368a593019bec1e14b1b6627..239ff76bbaa3267e8060acbfd358cdb244d51068 100644 (file)
@@ -51,6 +51,7 @@ block_Realloc
 __config_AddIntf
 config_ChainCreate
 config_ChainDestroy
+config_ChainDuplicate
 __config_ChainParse
 __config_ExistIntf
 config_FindConfig