[vlc-commits] upnp: make p_server_list static

Steve Lhomme git at videolan.org
Sun Jun 5 14:35:13 CEST 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Jun  2 14:08:16 2016 +0200| [417c3cdbabcd8bd09576225589cd13b196a35121] | committer: Thomas Guillem

upnp: make p_server_list static

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/services_discovery/upnp.cpp |   14 +++++++-------
 modules/services_discovery/upnp.hpp |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index e9dbdda..adc2329 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -74,6 +74,7 @@ struct access_sys_t
 
 UpnpInstanceWrapper* UpnpInstanceWrapper::s_instance;
 vlc_mutex_t UpnpInstanceWrapper::s_lock = VLC_STATIC_MUTEX;
+SD::MediaServerList *UpnpInstanceWrapper::p_server_list = NULL;
 
 /*
  * VLC callback prototypes
@@ -1221,7 +1222,6 @@ static void Close( vlc_object_t* p_this )
 
 UpnpInstanceWrapper::UpnpInstanceWrapper()
     : m_handle( -1 )
-    , p_server_list( NULL )
     , m_refcount( 0 )
 {
     vlc_mutex_init( &m_server_list_lock );
@@ -1298,8 +1298,8 @@ UpnpInstanceWrapper *UpnpInstanceWrapper::get(vlc_object_t *p_obj, services_disc
     if (p_server_list != NULL)
     {
         vlc_mutex_locker lock( &s_instance->m_server_list_lock );
-        assert(!s_instance->p_server_list);
-        s_instance->p_server_list = p_server_list;
+        assert(!UpnpInstanceWrapper::p_server_list);
+        UpnpInstanceWrapper::p_server_list = p_server_list;
     }
     return s_instance;
 }
@@ -1310,8 +1310,8 @@ void UpnpInstanceWrapper::release(bool isSd)
     if ( isSd )
     {
         vlc_mutex_locker lock( &m_server_list_lock );
-        delete p_server_list;
-        p_server_list = NULL;
+        delete UpnpInstanceWrapper::p_server_list;
+        UpnpInstanceWrapper::p_server_list = NULL;
     }
     if (--s_instance->m_refcount == 0)
     {
@@ -1329,8 +1329,8 @@ int UpnpInstanceWrapper::Callback(Upnp_EventType event_type, void *p_event, void
 {
     UpnpInstanceWrapper* self = static_cast<UpnpInstanceWrapper*>( p_user_data );
     vlc_mutex_locker lock( &self->m_server_list_lock );
-    if ( !self->p_server_list )
+    if ( !UpnpInstanceWrapper::p_server_list )
         return 0;
-    SD::MediaServerList::Callback( event_type, p_event, self->p_server_list );
+    SD::MediaServerList::Callback( event_type, p_event, UpnpInstanceWrapper::p_server_list );
     return 0;
 }
diff --git a/modules/services_discovery/upnp.hpp b/modules/services_discovery/upnp.hpp
index 8e7686b..44fde4f 100644
--- a/modules/services_discovery/upnp.hpp
+++ b/modules/services_discovery/upnp.hpp
@@ -73,7 +73,7 @@ private:
     static vlc_mutex_t s_lock;
     UpnpClient_Handle m_handle;
     vlc_mutex_t m_server_list_lock; // protect p_server_list
-    SD::MediaServerList* p_server_list;
+    static SD::MediaServerList* p_server_list;
     int m_refcount;
 };
 



More information about the vlc-commits mailing list