diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-03-15 22:38:59 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-15 22:38:59 +0800 |
commit | 58d0d111af5580051b4d9a5cbaef4d7b96fdcfa8 (patch) | |
tree | b6d3a47f051d5d81fcc2c7219ff60a5a77711f77 /e-util | |
parent | ea52ab83fe121796a12a090ce81ba114d2c368ed (diff) | |
download | gsoc2013-evolution-58d0d111af5580051b4d9a5cbaef4d7b96fdcfa8.tar.gz gsoc2013-evolution-58d0d111af5580051b4d9a5cbaef4d7b96fdcfa8.tar.zst gsoc2013-evolution-58d0d111af5580051b4d9a5cbaef4d7b96fdcfa8.zip |
Prevent future bugs like #612792.
Add G_GNUC_NULL_TERMINATED to EAlert functions with variable-length
parameter lists and drop the unnecessary "arg0" parameter so the
function attribute works correctly.
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-alert-dialog.c | 12 | ||||
-rw-r--r-- | e-util/e-alert-dialog.h | 4 | ||||
-rw-r--r-- | e-util/e-alert.c | 10 | ||||
-rw-r--r-- | e-util/e-alert.h | 4 |
4 files changed, 15 insertions, 15 deletions
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c index 9a49a76223..09512ce17c 100644 --- a/e-util/e-alert-dialog.c +++ b/e-util/e-alert-dialog.c @@ -274,14 +274,14 @@ e_alert_dialog_new (GtkWindow *parent, EAlert *alert) } GtkWidget* -e_alert_dialog_new_for_args (GtkWindow *parent, const gchar *tag, const gchar *arg0, ...) +e_alert_dialog_new_for_args (GtkWindow *parent, const gchar *tag, ...) { GtkWidget *d; EAlert *e; va_list ap; - va_start(ap, arg0); - e = e_alert_new_valist(tag, arg0, ap); + va_start(ap, tag); + e = e_alert_new_valist(tag, ap); va_end(ap); d = e_alert_dialog_new (parent, e); @@ -305,14 +305,14 @@ e_alert_run_dialog(GtkWindow *parent, EAlert *alert) } gint -e_alert_run_dialog_for_args (GtkWindow *parent, const gchar *tag, const gchar *arg0, ...) +e_alert_run_dialog_for_args (GtkWindow *parent, const gchar *tag, ...) { EAlert *e; va_list ap; gint response; - va_start(ap, arg0); - e = e_alert_new_valist(tag, arg0, ap); + va_start(ap, tag); + e = e_alert_new_valist(tag, ap); va_end(ap); response = e_alert_run_dialog (parent, e); diff --git a/e-util/e-alert-dialog.h b/e-util/e-alert-dialog.h index df87c90f99..2be298e8dc 100644 --- a/e-util/e-alert-dialog.h +++ b/e-util/e-alert-dialog.h @@ -69,11 +69,11 @@ struct _EAlertDialogClass GType e_alert_dialog_get_type (void); GtkWidget* e_alert_dialog_new (GtkWindow* parent, EAlert *alert); -GtkWidget* e_alert_dialog_new_for_args (GtkWindow* parent, const gchar *tag, const gchar *arg0, ...); +GtkWidget* e_alert_dialog_new_for_args (GtkWindow* parent, const gchar *tag, ...) G_GNUC_NULL_TERMINATED; /* Convenience functions for displaying the alert in a GtkDialog */ gint e_alert_run_dialog(GtkWindow *parent, EAlert *alert); -gint e_alert_run_dialog_for_args (GtkWindow *parent, const gchar *tag, const gchar *arg0, ...); +gint e_alert_run_dialog_for_args (GtkWindow *parent, const gchar *tag, ...) G_GNUC_NULL_TERMINATED; guint e_alert_dialog_count_buttons (EAlertDialog *dialog); EAlert *e_alert_dialog_get_alert (EAlertDialog *dialog); diff --git a/e-util/e-alert.c b/e-util/e-alert.c index b3a7859da5..3c7aca3ee1 100644 --- a/e-util/e-alert.c +++ b/e-util/e-alert.c @@ -499,25 +499,25 @@ e_alert_init (EAlert *self) * Returns: a new #EAlert **/ EAlert * -e_alert_new(const gchar *tag, const gchar *arg0, ...) +e_alert_new(const gchar *tag, ...) { EAlert *e; va_list ap; - va_start(ap, arg0); - e = e_alert_new_valist(tag, arg0, ap); + va_start(ap, tag); + e = e_alert_new_valist(tag, ap); va_end(ap); return e; } EAlert * -e_alert_new_valist(const gchar *tag, const gchar *arg0, va_list ap) +e_alert_new_valist(const gchar *tag, va_list ap) { gchar *tmp; GPtrArray *args = g_ptr_array_new_with_free_func (g_free); - tmp = (gchar *)arg0; + tmp = va_arg (ap, gchar *); while (tmp) { g_ptr_array_add(args, g_strdup (tmp)); tmp = va_arg(ap, gchar *); diff --git a/e-util/e-alert.h b/e-util/e-alert.h index 743db9761f..d0a4a0b502 100644 --- a/e-util/e-alert.h +++ b/e-util/e-alert.h @@ -97,8 +97,8 @@ struct _EAlertClass GType e_alert_get_type (void); -EAlert *e_alert_new(const gchar *tag, const gchar *arg0, ...); -EAlert *e_alert_new_valist(const gchar *tag, const gchar *arg0, va_list ap); +EAlert *e_alert_new(const gchar *tag, ...); +EAlert *e_alert_new_valist(const gchar *tag, va_list ap); EAlert *e_alert_new_array(const gchar *tag, GPtrArray *args); guint32 e_alert_get_flags (EAlert *alert); |