Commit 9bf71ea2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Only take top-most object message header

In practice, multiple headers cannot happen. Only VLM input and LUA
interface use this hack.
parent f68b07bf
...@@ -261,7 +261,6 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, ...@@ -261,7 +261,6 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
const char *psz_module, const char *psz_module,
const char *psz_format, va_list _args) const char *psz_format, va_list _args)
{ {
vlc_object_t *p_obj;
char * psz_str = NULL; /* formatted message string */ char * psz_str = NULL; /* formatted message string */
va_list args; va_list args;
...@@ -372,36 +371,15 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, ...@@ -372,36 +371,15 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
msg.psz_object_type = p_this->psz_object_type; msg.psz_object_type = p_this->psz_object_type;
msg.psz_module = psz_module; msg.psz_module = psz_module;
msg.psz_msg = psz_str; msg.psz_msg = psz_str;
msg.psz_header = NULL;
char *psz_header = NULL; for (vlc_object_t *o = p_this; o != NULL; o = o->p_parent)
size_t i_header_size = 0; if (o->psz_header != NULL)
p_obj = p_this;
while( p_obj != NULL )
{
char *psz_old = NULL;
if( p_obj->psz_header )
{ {
i_header_size += strlen( p_obj->psz_header ) + 4; if (asprintf (&msg.psz_header, "[%s]", o->psz_header) == -1)
if( psz_header ) msg.psz_header = NULL;
{ break;
psz_old = strdup( psz_header );
psz_header = xrealloc( psz_header, i_header_size );
snprintf( psz_header, i_header_size , "[%s] %s",
p_obj->psz_header, psz_old );
}
else
{
psz_header = xmalloc( i_header_size );
snprintf( psz_header, i_header_size, "[%s]",
p_obj->psz_header );
}
} }
free( psz_old );
p_obj = p_obj->p_parent;
}
msg.psz_header = psz_header;
PrintMsg( p_this, &msg ); PrintMsg( p_this, &msg );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment