diff -r b5b1db6007b0 -r a178d3dcbb7f src/debug.c --- a/src/debug.c Thu Jul 06 08:24:26 2006 +0000 +++ b/src/debug.c Thu Jul 06 09:21:57 2006 +0000 @@ -46,14 +46,20 @@ const char *format, va_list args) { GaimDebugUiOps *ops; + char *arg_s = NULL; g_return_if_fail(level != GAIM_DEBUG_ALL); g_return_if_fail(format != NULL); + ops = gaim_debug_get_ui_ops(); + + if (!debug_enabled && ((ops == NULL) || (ops->print == NULL))) + return; + + arg_s = g_strdup_vprintf(format, args); + if (debug_enabled) { - gchar *arg_s, *ts_s; - - arg_s = g_strdup_vprintf(format, args); + gchar *ts_s; if ((category != NULL) && (gaim_prefs_exists("/core/debug/timestamps")) && @@ -72,14 +78,13 @@ else g_print("%s%s: %s", ts_s, category, arg_s); - g_free(arg_s); g_free(ts_s); } - ops = gaim_debug_get_ui_ops(); + if (ops != NULL && ops->print != NULL) + ops->print(level, category, arg_s); - if (ops != NULL && ops->print != NULL) - ops->print(level, category, format, args); + g_free(arg_s); } void