From 2b74408d5e810e16b1e32a4f1e520004b0e8aeec Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 7 Feb 2010 15:08:25 +0200 Subject: [PATCH] msg: improve show_readable() So that we don't waste resources when nothing is printed. Signed-off-by: Felipe Contreras --- cmd/msg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/msg.c b/cmd/msg.c index 963f408..62e26d7 100644 --- a/cmd/msg.c +++ b/cmd/msg.c @@ -710,6 +710,7 @@ void msn_message_show_readable(MsnMessage *msg, const char *info, gboolean text_body) { +#if defined(PN_DEBUG) GString *str; size_t body_len; const char *body; @@ -717,6 +718,9 @@ msn_message_show_readable(MsnMessage *msg, const char *info, g_return_if_fail(msg != NULL); + if (PECAN_LOG_LEVEL < PN_LOG_LEVEL_DEBUG) + return; + str = g_string_new(NULL); /* Standard header. */ @@ -803,4 +807,5 @@ msn_message_show_readable(MsnMessage *msg, const char *info, pn_debug ("info=[%s],str=[%s]", info, str->str); g_string_free(str, TRUE); +#endif /* PN_DEBUG */ }