[vlc-commits] No need to copy msg_item_t.psz_header
Rémi Denis-Courmont
git at videolan.org
Wed May 11 18:54:35 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 11 19:10:38 2011 +0300| [f2fd47b4b4168eb53da241ca6671fbb85b61b7ad] | committer: Rémi Denis-Courmont
No need to copy msg_item_t.psz_header
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f2fd47b4b4168eb53da241ca6671fbb85b61b7ad
---
include/vlc_messages.h | 4 ++--
modules/misc/logger.c | 8 ++++----
src/misc/messages.c | 6 ++----
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index cfe5d94..b4b37d6 100644
--- a/include/vlc_messages.h
+++ b/include/vlc_messages.h
@@ -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);
}
diff --git a/modules/misc/logger.c b/modules/misc/logger.c
index a275498..1183ef0 100644
--- a/modules/misc/logger.c
+++ b/modules/misc/logger.c
@@ -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
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 57c9390..3cdd8b7 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -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)
More information about the vlc-commits
mailing list