[vlc-devel] commit: Alloc memory later, remove non-compilable goto ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Oct 15 17:55:10 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Oct 15 18:54:24 2008 +0300| [cf08617d75baea2246e88d2a690a00b35545f788] | committer: Rémi Denis-Courmont 

Alloc memory later, remove non-compilable goto

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

 src/misc/messages.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index a7c096d..087d9cd 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -330,17 +330,10 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
     char *       psz_str = NULL;                 /* formatted message string */
     char *       psz_header = NULL;
     va_list      args;
-    msg_item_t * p_item = malloc (sizeof (*p_item));
-
-    if (p_item == NULL)
-        return; /* Uho! */
-
-    vlc_gc_init (p_item, msg_Free);
-    p_item->psz_module = p_item->psz_msg = p_item->psz_header = NULL;
 
     if( p_this->i_flags & OBJECT_FLAGS_QUIET ||
         (p_this->i_flags & OBJECT_FLAGS_NODBG && i_type == VLC_MSG_DBG) )
-        goto out;
+        return;
 
 #ifndef __GLIBC__
     /* Expand %m to strerror(errno) - only once */
@@ -427,9 +420,19 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
         va_end( args );
         fputs( "\n", stderr );
         vlc_restorecancel (canc);
-        goto out;
+        return;
     }
 
+    msg_item_t * p_item = malloc (sizeof (*p_item));
+
+    if (p_item == NULL)
+        return; /* Uho! */
+
+    vlc_gc_init (p_item, msg_Free);
+    p_item->psz_module = p_item->psz_msg = p_item->psz_header = NULL;
+
+
+
     i_header_size = 0;
     p_obj = p_this;
     while( p_obj != NULL )
@@ -483,7 +486,6 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
     }
     vlc_cond_broadcast (&bank->wait);
     vlc_mutex_unlock (&bank->lock);
-out:
     msg_Release (p_item);
 }
 




More information about the vlc-devel mailing list