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

No need to copy msg_item_t.psz_header

parent fc908a6d
......@@ -51,8 +51,8 @@ typedef struct
uintptr_t i_object_id;
const char *psz_object_type;
const char *psz_module;
const char *psz_header; /**< Additional header */
char * psz_msg; /**< the message itself */
char * psz_header; /**< Additional header */
} msg_item_t;
/* Message types */
......@@ -81,8 +81,8 @@ static inline msg_item_t *msg_Copy (const msg_item_t *msg)
static inline void msg_Free (msg_item_t *msg)
{
free ((char *)msg->psz_module);
free ((char *)msg->psz_header);
free (msg->psz_msg);
free (msg->psz_header);
free (msg);
}
......
......@@ -429,11 +429,11 @@ static void SyslogPrint( const msg_item_t *p_msg )
int i_priority = i_prio[p_msg->i_type];
if( p_msg->psz_header )
syslog( i_priority, "%s %s%s%s", p_msg->psz_header, p_msg->psz_module,
ppsz_type[p_msg->i_type], p_msg->psz_msg );
syslog( i_priority, "[%s] %s%s%s", p_msg->psz_header,
p_msg->psz_module, ppsz_type[p_msg->i_type], p_msg->psz_msg );
else
syslog( i_priority, "%s%s%s", p_msg->psz_module,
ppsz_type[p_msg->i_type], p_msg->psz_msg );
syslog( i_priority, "%s%s%s",
p_msg->psz_module, ppsz_type[p_msg->i_type], p_msg->psz_msg );
}
#endif
......
......@@ -376,8 +376,7 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
for (vlc_object_t *o = p_this; o != NULL; o = o->p_parent)
if (o->psz_header != NULL)
{
if (asprintf (&msg.psz_header, "[%s]", o->psz_header) == -1)
msg.psz_header = NULL;
msg.psz_header = o->psz_header;
break;
}
......@@ -418,7 +417,6 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type,
}
vlc_rwlock_unlock (&bank->lock);
free (msg.psz_msg);
free (msg.psz_header);
}
/*****************************************************************************
......@@ -484,7 +482,7 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item )
fprintf (stream, priv->b_color ? "["GREEN"%p"GRAY"] " : "[%p] ",
(void *)p_item->i_object_id);
if (p_item->psz_header != NULL)
utf8_fprintf (stream, "%s ", p_item->psz_header);
utf8_fprintf (stream, "[%s] ", p_item->psz_header);
utf8_fprintf (stream, "%s %s%s: ", p_item->psz_module, objtype,
msgtype[i_type]);
if (priv->b_color)
......
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