[vlc-devel] commit: vlc_custom_create: no need to invoke the global root object ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Aug 30 11:54:14 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Aug 30 12:56:28 2008 +0300| [c700d394095e7abfe509abdd612c190ce134d590] | committer: Rémi Denis-Courmont 

vlc_custom_create: no need to invoke the global root object

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

 src/misc/objects.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index 58140dd..77abc03 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -142,20 +142,17 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
         return NULL;
     }
 
-    libvlc_global_data_t *p_libvlc_global;
     if( p_this == NULL )
     {
         /* Only the global root object is created out of the blue */
-        p_libvlc_global = (libvlc_global_data_t *)p_new;
         p_new->p_libvlc = NULL;
 
         object_counter = 0; /* reset */
-        p_priv->next = p_priv->prev = p_new;
+        p_this = p_priv->next = p_priv->prev = p_new;
         vlc_mutex_init( &structure_lock );
     }
     else
     {
-        p_libvlc_global = vlc_global();
         if( i_type == VLC_OBJECT_LIBVLC )
             p_new->p_libvlc = (libvlc_int_t*)p_new;
         else
@@ -179,10 +176,10 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     vlc_spin_init( &p_priv->spin );
     p_priv->pipes[0] = p_priv->pipes[1] = -1;
 
-    p_priv->next = VLC_OBJECT (p_libvlc_global);
+    p_priv->next = p_this;
     vlc_mutex_lock( &structure_lock );
-    p_priv->prev = vlc_internals (p_libvlc_global)->prev;
-    vlc_internals (p_libvlc_global)->prev = p_new;
+    p_priv->prev = vlc_internals (p_this)->prev;
+    vlc_internals (p_this)->prev = p_new;
     vlc_internals (p_priv->prev)->next = p_new;
     p_new->i_object_id = object_counter++; /* fetch THEN increment */
     vlc_mutex_unlock( &structure_lock );




More information about the vlc-devel mailing list