[vlc-devel] commit: sout_std: imporve logic (and save a malloc/free) ( Rémi Duraffort )

git version control git at videolan.org
Sat Oct 10 11:57:44 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Oct  2 20:27:06 2009 +0200| [6555b58041742020eb10334672c03e263e2ced8e] | committer: Rémi Duraffort 

sout_std: imporve logic (and save a malloc/free)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6555b58041742020eb10334672c03e263e2ced8e
---

 modules/stream_out/standard.c |   37 +++++++++++++++----------------------
 1 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index b1b91dc..98df673 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -170,7 +170,7 @@ static int Open( vlc_object_t *p_this )
     sout_stream_sys_t   *p_sys;
 
     char *psz_mux;
-    char *psz_access=NULL;
+    char *psz_access;
     char *psz_url=NULL;
     char *psz_bind;
     char *psz_path;
@@ -185,28 +185,21 @@ static int Open( vlc_object_t *p_this )
     config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
-    if( !strcmp( p_stream->psz_name, "http" ) )
+    psz_access = var_GetString( p_stream, SOUT_CFG_PREFIX "access" );
+    if( EMPTY_STR(psz_access) )
     {
-        psz_access = strdup("http");
-    }
-    else if (!strcmp (p_stream->psz_name, "udp"))
-    {
-        psz_access = strdup("udp");
-    }
-    else if (!strcmp (p_stream->psz_name, "file"))
-    {
-        psz_access = strdup("file");
-    }
-
-    var_Get( p_stream, SOUT_CFG_PREFIX "access", &val );
-    if( *val.psz_string )
-    {
-        free( psz_access );
-        psz_access = val.psz_string;
-    }
-    else
-    {
-        free( val.psz_string );
+        if( !strcmp( p_stream->psz_name, "http" ) )
+        {
+            psz_access = strdup("http");
+        }
+        else if (!strcmp (p_stream->psz_name, "udp"))
+        {
+            psz_access = strdup("udp");
+        }
+        else if (!strcmp (p_stream->psz_name, "file"))
+        {
+            psz_access = strdup("file");
+        }
     }
 
     psz_mux = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "mux" );




More information about the vlc-devel mailing list