[vlc-devel] commit: Use libvlc_priv_t for httpd ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun May 4 19:54:03 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sun May  4 20:45:17 2008 +0300| [40f43d3256ee86695e0bf44adabb691707d5de01]

Use libvlc_priv_t for httpd

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

 src/libvlc-common.c |    2 +-
 src/network/httpd.c |   12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index 5c11207..d2efb76 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -178,11 +178,11 @@ libvlc_int_t * libvlc_InternalCreate( void )
     if( p_libvlc == NULL )
         return NULL;
 
+    priv = libvlc_priv (p_libvlc);
     p_libvlc->p_playlist = NULL;
     p_libvlc->p_interaction = NULL;
     priv->p_vlm = NULL;
     p_libvlc->psz_object_name = strdup( "libvlc" );
-    priv = libvlc_priv (p_libvlc);
 
     /* Initialize message queue */
     msg_Create( p_libvlc );
diff --git a/src/network/httpd.c b/src/network/httpd.c
index ec18c72..6d5adfe 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -996,14 +996,11 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
 
     /* to be sure to avoid multiple creation */
     var_Create( p_this->p_libvlc, "httpd_mutex", VLC_VAR_MUTEX );
-    var_Create( p_this->p_libvlc, "httpd_object", VLC_VAR_ADDRESS );
     var_Get( p_this->p_libvlc, "httpd_mutex", &lockval );
     vlc_mutex_lock( lockval.p_address );
-    var_Get( p_this->p_libvlc, "httpd_object", &ptrval );
+    httpd = libvlc_priv (p_this->p_libvlc)->p_httpd;
 
-    if( ptrval.p_address != NULL )
-        httpd = ptrval.p_address;
-    else
+    if( httpd == NULL )
     {
         msg_Info( p_this, "creating httpd" );
         httpd = (httpd_t *)vlc_custom_create( p_this, sizeof (*httpd),
@@ -1020,7 +1017,7 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
         httpd->host   = NULL;
 
         ptrval.p_address = httpd;
-        var_Set( p_this->p_libvlc, "httpd_object", ptrval );
+        libvlc_priv (p_this->p_libvlc)->p_httpd = httpd;
         vlc_object_yield( httpd );
         vlc_object_attach( httpd, p_this->p_libvlc );
     }
@@ -1201,8 +1198,7 @@ void httpd_HostDelete( httpd_host_t *host )
 
         msg_Dbg( httpd, "no host left, stopping httpd" );
 
-        ptrval.p_address = NULL;
-        var_Set( httpd->p_libvlc, "httpd_object", ptrval );
+        libvlc_priv (httpd->p_libvlc)->p_httpd = NULL;
         vlc_object_detach( httpd );
         vlc_object_release( httpd );
 




More information about the vlc-devel mailing list