]> git.sesse.net Git - vlc/blobdiff - src/misc/messages.c
macosx: Fix addNode:.
[vlc] / src / misc / messages.c
index 38752e90c073fe25d90aa20fa3961afbc0e45606..be832c65c87fba5ec3ea54be0cd2c8e3768f2059 100644 (file)
@@ -32,7 +32,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 
 #include <stdarg.h>                                       /* va_list for BSD */
 
@@ -523,8 +523,8 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
 #ifdef UNDER_CE
     int i_dummy;
 #endif
-    static const char * ppsz_type[4] = { "", " error", " warning", " debug" };
-    static const char *ppsz_color[4] = { WHITE, RED, YELLOW, GRAY };
+    static const char ppsz_type[4][9] = { "", " error", " warning", " debug" };
+    static const char ppsz_color[4][8] = { WHITE, RED, YELLOW, GRAY };
     const char *psz_object;
     libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc);
     int i_type = p_item->i_type;
@@ -614,6 +614,14 @@ static msg_context_t* GetContext(void)
     return p_ctx;
 }
 
+void msg_StackDestroy (void *data)
+{
+    msg_context_t *p_ctx = data;
+
+    free (p_ctx->psz_message);
+    free (p_ctx);
+}
+
 void msg_StackSet( int i_code, const char *psz_message, ... )
 {
     va_list ap;
@@ -621,10 +629,9 @@ void msg_StackSet( int i_code, const char *psz_message, ... )
 
     if( p_ctx == NULL )
         return;
-
-    va_start( ap, psz_message );
     free( p_ctx->psz_message );
 
+    va_start( ap, psz_message );
     if( vasprintf( &p_ctx->psz_message, psz_message, ap ) == -1 )
         p_ctx->psz_message = NULL;
     va_end( ap );