Mercurial > pidgin
comparison src/debug.c @ 13926:756c3d7177d9
[gaim-migrate @ 16445]
Fix a crash bug on some systems (mostly amd64) caused by using a va_list
twice. My bad! Thanks to Kevin Stange and Vincent Ho for noticing this
and suggesting the cause. Vincent's IRC handle reminds me of a Harvey
Danger song.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Thu, 06 Jul 2006 09:21:57 +0000 |
| parents | e1e5462b7d81 |
| children |
comparison
equal
deleted
inserted
replaced
| 13925:60f39c405dff | 13926:756c3d7177d9 |
|---|---|
| 44 static void | 44 static void |
| 45 gaim_debug_vargs(GaimDebugLevel level, const char *category, | 45 gaim_debug_vargs(GaimDebugLevel level, const char *category, |
| 46 const char *format, va_list args) | 46 const char *format, va_list args) |
| 47 { | 47 { |
| 48 GaimDebugUiOps *ops; | 48 GaimDebugUiOps *ops; |
| 49 char *arg_s = NULL; | |
| 49 | 50 |
| 50 g_return_if_fail(level != GAIM_DEBUG_ALL); | 51 g_return_if_fail(level != GAIM_DEBUG_ALL); |
| 51 g_return_if_fail(format != NULL); | 52 g_return_if_fail(format != NULL); |
| 52 | 53 |
| 54 ops = gaim_debug_get_ui_ops(); | |
| 55 | |
| 56 if (!debug_enabled && ((ops == NULL) || (ops->print == NULL))) | |
| 57 return; | |
| 58 | |
| 59 arg_s = g_strdup_vprintf(format, args); | |
| 60 | |
| 53 if (debug_enabled) { | 61 if (debug_enabled) { |
| 54 gchar *arg_s, *ts_s; | 62 gchar *ts_s; |
| 55 | |
| 56 arg_s = g_strdup_vprintf(format, args); | |
| 57 | 63 |
| 58 if ((category != NULL) && | 64 if ((category != NULL) && |
| 59 (gaim_prefs_exists("/core/debug/timestamps")) && | 65 (gaim_prefs_exists("/core/debug/timestamps")) && |
| 60 (gaim_prefs_get_bool("/core/debug/timestamps"))) { | 66 (gaim_prefs_get_bool("/core/debug/timestamps"))) { |
| 61 const char *mdate; | 67 const char *mdate; |
| 70 if (category == NULL) | 76 if (category == NULL) |
| 71 g_print("%s%s", ts_s, arg_s); | 77 g_print("%s%s", ts_s, arg_s); |
| 72 else | 78 else |
| 73 g_print("%s%s: %s", ts_s, category, arg_s); | 79 g_print("%s%s: %s", ts_s, category, arg_s); |
| 74 | 80 |
| 75 g_free(arg_s); | |
| 76 g_free(ts_s); | 81 g_free(ts_s); |
| 77 } | 82 } |
| 78 | 83 |
| 79 ops = gaim_debug_get_ui_ops(); | 84 if (ops != NULL && ops->print != NULL) |
| 85 ops->print(level, category, arg_s); | |
| 80 | 86 |
| 81 if (ops != NULL && ops->print != NULL) | 87 g_free(arg_s); |
| 82 ops->print(level, category, format, args); | |
| 83 } | 88 } |
| 84 | 89 |
| 85 void | 90 void |
| 86 gaim_debug(GaimDebugLevel level, const char *category, | 91 gaim_debug(GaimDebugLevel level, const char *category, |
| 87 const char *format, ...) | 92 const char *format, ...) |
