changeset 14643:4df2827fc2eb

[gaim-migrate @ 17389] Fix sf bug #1469293 Checking if a va_list != NULL is not valid because va_list is not a pointer on some platforms. Conveniently the check wasn't necessary. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 28 Sep 2006 07:01:47 +0000
parents 426383e5b45d
children b05f686280f9
files libgaim/account.c libgaim/account.h libgaim/status.c
diffstat 3 files changed, 16 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/account.c	Thu Sep 28 06:32:53 2006 +0000
+++ b/libgaim/account.c	Thu Sep 28 07:01:47 2006 +0000
@@ -1369,32 +1369,21 @@
 gaim_account_set_status(GaimAccount *account, const char *status_id,
 						gboolean active, ...)
 {
+	GList *attrs = NULL;
+	const gchar *id;
+	gpointer data;
 	va_list args;
 
 	va_start(args, active);
-	gaim_account_set_status_vargs(account, status_id, active, args);
-	va_end(args);
-}
-
-void
-gaim_account_set_status_vargs(GaimAccount *account, const char *status_id,
-							  gboolean active, va_list args)
-{
-	GList *attrs = NULL;
-	const gchar *id;
-	gpointer data;
-
-	if (args != NULL)
+	while ((id = va_arg(args, const char *)) != NULL)
 	{
-		while ((id = va_arg(args, const char *)) != NULL)
-		{
-			attrs = g_list_append(attrs, (char *)id);
-			data = va_arg(args, void *);
-			attrs = g_list_append(attrs, data);
-		}
+		attrs = g_list_append(attrs, (char *)id);
+		data = va_arg(args, void *);
+		attrs = g_list_append(attrs, data);
 	}
 	gaim_account_set_status_list(account, status_id, active, attrs);
 	g_list_free(attrs);
+	va_end(args);
 }
 
 void
--- a/libgaim/account.h	Thu Sep 28 06:32:53 2006 +0000
+++ b/libgaim/account.h	Thu Sep 28 07:01:47 2006 +0000
@@ -287,8 +287,7 @@
 
 /**
  * Activates or deactivates a status.  All changes to the statuses of
- * an account go through this function or gaim_account_set_status_vargs
- * or gaim_account_set_status_list.
+ * an account go through this function or gaim_account_set_status_list.
  *
  * Only independent statuses can be deactivated with this. To deactivate
  * an exclusive status, activate a different (and exclusive?) status.
@@ -296,8 +295,8 @@
  * @param account   The account.
  * @param status_id The ID of the status.
  * @param active    The active state.
- * @param ...       Optional NULL-terminated attributes passed for the
- *                  new status, in an id, value pair.
+ * @param ...       Pairs of attributes for the new status passed in
+ *                  as a NULL-terminated list of id/value pairs.
  */
 void gaim_account_set_status(GaimAccount *account, const char *status_id,
 							 gboolean active, ...);
@@ -305,25 +304,7 @@
 
 /**
  * Activates or deactivates a status.  All changes to the statuses of
- * an account go through this function or gaim_account_set_status or
- * gaim_account_set_status_list.
- *
- * Only independent statuses can be deactivated with this. To deactivate
- * an exclusive status, activate a different (and exclusive?) status.
- *
- * @param account   The account.
- * @param status_id The ID of the status.
- * @param active    The active state.
- * @param args      The va_list of attributes.
- */
-void gaim_account_set_status_vargs(GaimAccount *account,
-								   const char *status_id,
-								   gboolean active, va_list args);
-
-/**
- * Activates or deactivates a status.  All changes to the statuses of
- * an account go through this function or gaim_account_set_status or
- * gaim_account_set_status_vargs.
+ * an account go through this function or gaim_account_set_status.
  *
  * Only independent statuses can be deactivated with this. To deactivate
  * an exclusive status, activate a different (and exclusive?) status.
--- a/libgaim/status.c	Thu Sep 28 06:32:53 2006 +0000
+++ b/libgaim/status.c	Thu Sep 28 07:01:47 2006 +0000
@@ -718,14 +718,11 @@
 	const gchar *id;
 	gpointer data;
 
-	if (args != NULL)
+	while ((id = va_arg(args, const char *)) != NULL)
 	{
-		while ((id = va_arg(args, const char *)) != NULL)
-		{
-			attrs = g_list_append(attrs, (char *)id);
-			data = va_arg(args, void *);
-			attrs = g_list_append(attrs, data);
-		}
+		attrs = g_list_append(attrs, (char *)id);
+		data = va_arg(args, void *);
+		attrs = g_list_append(attrs, data);
 	}
 	gaim_status_set_active_with_attrs_list(status, active, attrs);
 	g_list_free(attrs);