Commit 00aa3ff1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

GetNonEmptyString simplification

parent d1503b12
......@@ -91,8 +91,8 @@ int E_(HTTPOpen)( access_t *p_access )
p_sys->b_request_frontend_info = p_sys->b_request_mmi_info = VLC_FALSE;
p_sys->i_httpd_timeout = 0;
psz_address = var_GetString( p_access, "dvb-http-host" );
if( psz_address != NULL && *psz_address )
psz_address = var_GetNonEmptyString( p_access, "dvb-http-host" );
if( psz_address != NULL )
{
char *psz_parser = strchr( psz_address, ':' );
if( psz_parser )
......@@ -102,14 +102,11 @@ int E_(HTTPOpen)( access_t *p_access )
}
}
else
{
if ( psz_address != NULL ) free( psz_address );
return VLC_SUCCESS;
}
/* determine SSL configuration */
psz_cert = var_GetString( p_access, "dvb-http-intf-cert" );
if ( psz_cert != NULL && *psz_cert )
psz_cert = var_GetNonEmptyString( p_access, "dvb-http-intf-cert" );
if ( psz_cert != NULL )
{
msg_Dbg( p_access, "enabling TLS for HTTP interface (cert file: %s)",
psz_cert );
......@@ -122,11 +119,6 @@ int E_(HTTPOpen)( access_t *p_access )
}
else
{
if ( !*psz_cert )
{
free( psz_cert );
psz_cert = NULL;
}
if ( i_port <= 0 )
i_port= 8082;
}
......@@ -140,10 +132,10 @@ int E_(HTTPOpen)( access_t *p_access )
p_sys->p_httpd_host = httpd_TLSHostNew( VLC_OBJECT(p_access), psz_address,
i_port, psz_cert, psz_key, psz_ca,
psz_crl );
FREE( psz_cert );
FREE( psz_key );
FREE( psz_ca );
FREE( psz_crl );
free( psz_cert );
free( psz_key );
free( psz_ca );
free( psz_crl );
if ( p_sys->p_httpd_host == NULL )
{
......@@ -175,9 +167,9 @@ int E_(HTTPOpen)( access_t *p_access )
psz_user, psz_password, p_acl,
HttpCallback, f );
FREE( psz_user );
FREE( psz_password );
FREE( psz_acl );
free( psz_user );
free( psz_password );
free( psz_acl );
if ( p_acl != NULL )
ACL_Destroy( p_acl );
......
......@@ -555,15 +555,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
#endif
static char *GetTmpFilePath( access_t *p_access )
{
char *psz_dir = var_GetString( p_access, "timeshift-dir" );
char *psz_dir = var_GetNonEmptyString( p_access, "timeshift-dir" );
char *psz_filename_base;
if( ( psz_dir != NULL ) && ( psz_dir[0] == '\0' ) )
{
free( psz_dir );
psz_dir = NULL;
}
if( psz_dir == NULL )
{
#ifdef WIN32
......
......@@ -136,12 +136,7 @@ static int Open( vlc_object_t *p_this )
int i_port = 0;
char *psz_src;
var_Create(p_intf->p_libvlc, "http-host", VLC_VAR_STRING );
psz_address = var_GetString(p_intf->p_libvlc, "http-host");
if( !psz_address || !*psz_address )
{
psz_address = config_GetPsz( p_intf, "http-host" );
}
psz_address = var_GetNonEmptyString(p_intf->p_libvlc, "http-host");
if( psz_address != NULL )
{
char *psz_parser = strchr( psz_address, ':' );
......@@ -260,9 +255,9 @@ static int Open( vlc_object_t *p_this )
{
msg_Dbg( p_intf, "enabling TLS for HTTP interface (cert file: %s)",
psz_cert );
psz_key = config_GetPsz( p_intf, "http-intf-key" );
psz_ca = config_GetPsz( p_intf, "http-intf-ca" );
psz_crl = config_GetPsz( p_intf, "http-intf-crl" );
psz_key = var_GetNonEmptyString( p_intf, "http-intf-key" );
psz_ca = var_GetNonEmptyString( p_intf, "http-intf-ca" );
psz_crl = var_GetNonEmptyString( p_intf, "http-intf-crl" );
if( i_port <= 0 )
i_port = 8443;
......@@ -292,6 +287,7 @@ static int Open( vlc_object_t *p_this )
/* Ugly hack to run several HTTP servers on different ports */
snprintf( psz_tmp, sizeof (psz_tmp), "%s:%d", psz_address, i_port + 1 );
var_Create(p_intf->p_libvlc, "http-host", VLC_VAR_STRING );
var_SetString( p_intf->p_libvlc, "http-host", psz_tmp );
}
......@@ -379,11 +375,8 @@ static int Open( vlc_object_t *p_this )
return VLC_SUCCESS;
failed:
if( psz_src ) free( psz_src );
if( p_sys->pp_files )
{
free( p_sys->pp_files );
}
free( psz_src );
free( p_sys->pp_files );
httpd_HostDelete( p_sys->p_httpd_host );
free( p_sys->psz_address );
free( p_sys->psz_html_type );
......
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