# HG changeset patch # User William Pitcock # Date 1183015555 18000 # Node ID 6a474a7954a04eb4839a1a2fb055c4b21c8f4645 # Parent 21b27e97bfb9aa55ef612bea7f0ad49f7c3d973e Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf(). diff -r 21b27e97bfb9 -r 6a474a7954a0 src/audacious/main.c --- a/src/audacious/main.c Thu Jun 28 01:42:49 2007 -0500 +++ b/src/audacious/main.c Thu Jun 28 02:25:55 2007 -0500 @@ -1069,18 +1069,26 @@ gtk_widget_destroy(dialog); } -// use a format string? -void report_error(const gchar *error_text) +void report_error(const gchar *error_message, ...) { - fprintf(stderr, error_text); + gchar *buf; + va_list va; + + va_start(va, error_message); + buf = g_strdup_vprintf(error_message, va); + va_end(va); + + fprintf(stderr, buf); if (options.headless != 1) { gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), - error_text); + buf); gtk_dialog_run(GTK_DIALOG(err)); gtk_widget_hide(err); } + + g_free(buf); } static gboolean diff -r 21b27e97bfb9 -r 6a474a7954a0 src/audacious/main.h --- a/src/audacious/main.h Thu Jun 28 01:42:49 2007 -0500 +++ b/src/audacious/main.h Thu Jun 28 02:25:55 2007 -0500 @@ -168,7 +168,7 @@ void bmp_config_load(void); void bmp_config_free(void); void make_directory(const gchar * path, mode_t mode); -void report_error(const gchar *error_text); +void report_error(const gchar *error_message, ...); extern GCond *cond_scan; extern GMutex *mutex_scan;