[notification-daemon] Clean up notify_daemon_get_capabilities()
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [notification-daemon] Clean up notify_daemon_get_capabilities()
- Date: Thu, 24 Jun 2010 04:24:56 +0000 (UTC)
commit 30a8f896d3833247385f7192c5cd76b10f3e92fb
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jun 24 02:45:57 2010 +0100
Clean up notify_daemon_get_capabilities()
Using a GPtrArray, rather than incrementing by hand.
https://bugzilla.gnome.org/show_bug.cgi?id=608077
src/daemon/daemon.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index e621a76..d347ead 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -1620,14 +1620,19 @@ gboolean
notify_daemon_get_capabilities (NotifyDaemon *daemon,
char ***caps)
{
- *caps = g_new0 (char *, 6);
-
- (*caps)[0] = g_strdup ("actions");
- (*caps)[1] = g_strdup ("body");
- (*caps)[2] = g_strdup ("body-hyperlinks");
- (*caps)[3] = g_strdup ("body-markup");
- (*caps)[4] = g_strdup ("icon-static");
- (*caps)[5] = NULL;
+ GPtrArray *a;
+ char **_caps;
+
+ a = g_ptr_array_new ();
+ g_ptr_array_add (a, g_strdup ("actions"));
+ g_ptr_array_add (a, g_strdup ("body"));
+ g_ptr_array_add (a, g_strdup ("body-hyperlinks"));
+ g_ptr_array_add (a, g_strdup ("body-markup"));
+ g_ptr_array_add (a, g_strdup ("icon-static"));
+ g_ptr_array_add (a, NULL);
+ _caps = (char **) g_ptr_array_free (a, FALSE);
+
+ *caps = _caps;
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]