]> git.sesse.net Git - vlc/blobdiff - src/config/chain.c
Remove config_GetCacheDir
[vlc] / src / config / chain.c
index 3356ba87932f70f814cc4f16c21e2e97409ba65b..13661e5bdf852b2339857e23e445ea4968909fb6 100644 (file)
@@ -189,10 +189,6 @@ char *config_ChainCreate( char **ppsz_name, config_chain_t **pp_cfg,
 
     /* Look for parameter (a {...} or :...) or end of name (space or nul) */
     len = strcspn( psz_chain, "{: \t" );
-    if( len == 0 )
-        return NULL;
-
-    /* Extract the name */
     *ppsz_name = strndup( psz_chain, len );
     psz_chain += len;
 
@@ -416,6 +412,26 @@ 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;
+
+    for( ; p_src != NULL; p_src = p_src->p_next )
+    {
+        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;