[evolution] Prevent future bugs like #612792.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Prevent future bugs like #612792.
- Date: Mon, 15 Mar 2010 14:53:02 +0000 (UTC)
commit 58d0d111af5580051b4d9a5cbaef4d7b96fdcfa8
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Mar 15 10:38:59 2010 -0400
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.
composer/e-msg-composer.c | 6 +++---
doc/reference/shell/tmpl/e-alert.sgml | 2 --
e-util/e-alert-dialog.c | 12 ++++++------
e-util/e-alert-dialog.h | 4 ++--
e-util/e-alert.c | 10 +++++-----
e-util/e-alert.h | 4 ++--
mail/em-utils.c | 7 +++----
mail/em-utils.h | 2 +-
plugins/backup-restore/backup-restore.c | 6 +++---
9 files changed, 25 insertions(+), 28 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 86275b4..aa926b0 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -161,7 +161,7 @@ emcu_part_to_html (CamelMimePart *part, gssize *len, EMFormat *source)
/* copy of em_utils_prompt_user from mailer */
static gboolean
-emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, const gchar *arg0, ...)
+emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...)
{
GtkDialog *mbox;
GtkWidget *check = NULL;
@@ -176,8 +176,8 @@ emcu_prompt_user (GtkWindow *parent, const gchar *promptkey, const gchar *tag, c
return TRUE;
}
- va_start(ap, arg0);
- alert = e_alert_new_valist(tag, arg0, ap);
+ va_start(ap, tag);
+ alert = e_alert_new_valist(tag, ap);
va_end(ap);
mbox = (GtkDialog*) e_alert_dialog_new (parent, alert);
diff --git a/doc/reference/shell/tmpl/e-alert.sgml b/doc/reference/shell/tmpl/e-alert.sgml
index 6306548..93a52b3 100644
--- a/doc/reference/shell/tmpl/e-alert.sgml
+++ b/doc/reference/shell/tmpl/e-alert.sgml
@@ -94,7 +94,6 @@ User Alert Handling
</para>
@tag:
- arg0:
@Varargs:
@Returns:
@@ -116,7 +115,6 @@ User Alert Handling
@parent:
@tag:
- arg0:
@Varargs:
@Returns:
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index 9a49a76..09512ce 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 df87c90..2be298e 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 b3a7859..3c7aca3 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 743db97..d0a4a0b 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);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index d664a63..340ec58 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -117,7 +117,6 @@ em_utils_ask_open_many (GtkWindow *parent,
* @parent: parent window
* @promptkey: gconf key to check if we should prompt the user or not.
* @tag: e_alert tag.
- * @arg0: The first of a NULL terminated list of arguments for the error.
*
* Convenience function to query the user with a Yes/No dialog and a
* "Do not show this dialog again" checkbox. If the user checks that
@@ -127,7 +126,7 @@ em_utils_ask_open_many (GtkWindow *parent,
* Returns %TRUE if the user clicks Yes or %FALSE otherwise.
**/
gboolean
-em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, const gchar *arg0, ...)
+em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...)
{
GtkWidget *mbox, *check = NULL;
va_list ap;
@@ -139,8 +138,8 @@ em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag
&& !gconf_client_get_bool(gconf, promptkey, NULL))
return TRUE;
- va_start(ap, arg0);
- alert = e_alert_new_valist (tag, arg0, ap);
+ va_start(ap, tag);
+ alert = e_alert_new_valist (tag, ap);
va_end(ap);
mbox = e_alert_dialog_new (parent, alert);
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 4e3b95e..1bbde20 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -40,7 +40,7 @@ G_BEGIN_DECLS
struct _EMFormat;
gboolean em_utils_ask_open_many (GtkWindow *parent, gint how_many);
-gboolean em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, const gchar *arg0, ...);
+gboolean em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, ...);
GPtrArray *em_utils_uids_copy (GPtrArray *uids);
void em_utils_uids_free (GPtrArray *uids);
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c
index 80d0b76..5286605 100644
--- a/plugins/backup-restore/backup-restore.c
+++ b/plugins/backup-restore/backup-restore.c
@@ -95,7 +95,7 @@ sanity_check (const gchar *filename)
}
static guint32
-dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, const gchar *arg0, ...)
+dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, ...)
{
GtkWidget *mbox, *check = NULL;
va_list ap;
@@ -103,8 +103,8 @@ dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, con
guint32 mask = 0;
EAlert *alert = NULL;
- va_start(ap, arg0);
- alert = e_alert_new_valist(tag, arg0, ap);
+ va_start(ap, tag);
+ alert = e_alert_new_valist(tag, ap);
va_end(ap);
mbox = e_alert_dialog_new (parent, alert);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]