[Galago-commits] r2653 - in trunk/libgalago: . libgalago
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Sun Apr 2 15:56:58 PDT 2006
Author: chipx86
Date: 2006-04-02 15:56:56 -0700 (Sun, 02 Apr 2006)
New Revision: 2653
Modified:
trunk/libgalago/ChangeLog
trunk/libgalago/libgalago/galago-context.c
trunk/libgalago/libgalago/galago-dbus.c
trunk/libgalago/libgalago/galago-object.c
trunk/libgalago/libgalago/galago-service.c
Log:
- Fixed a couple more places where a DBusMessage reply could have fallen out of scope without being unreffed.
- Condensed some more code for readability purposes.
- Fixed a potential issue where we were getting a field in GalagoService back as an int, when we should have used dbus_uint32_t.
Modified: trunk/libgalago/ChangeLog
===================================================================
--- trunk/libgalago/ChangeLog 2006-04-02 22:54:35 UTC (rev 2652)
+++ trunk/libgalago/ChangeLog 2006-04-02 22:56:56 UTC (rev 2653)
@@ -1,3 +1,15 @@
+Sun Apr 02 15:55:10 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libgalago/galago-context.c:
+ * libgalago/galago-dbus.c:
+ * libgalago/galago-object.c:
+ * libgalago/galago-service.c:
+ - Fixed a couple more places where a DBusMessage reply could have
+ fallen out of scope without being unreffed.
+ - Condensed some more code for readability purposes.
+ - Fixed a potential issue where we were getting a field in GalagoService
+ back as an int, when we should have used dbus_uint32_t.
+
Sun Apr 02 15:53:18 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* tests/check-libgalago.c:
Modified: trunk/libgalago/libgalago/galago-context.c
===================================================================
--- trunk/libgalago/libgalago/galago-context.c 2006-04-02 22:54:35 UTC (rev 2652)
+++ trunk/libgalago/libgalago/galago-context.c 2006-04-02 22:56:56 UTC (rev 2653)
@@ -260,7 +260,6 @@
GalagoContext *context;
context = galago_context_get();
-
g_return_val_if_fail(context != NULL, NULL);
return context->priv->obj_path_prefix;
Modified: trunk/libgalago/libgalago/galago-dbus.c
===================================================================
--- trunk/libgalago/libgalago/galago-dbus.c 2006-04-02 22:54:35 UTC (rev 2652)
+++ trunk/libgalago/libgalago/galago-dbus.c 2006-04-02 22:56:56 UTC (rev 2653)
@@ -92,7 +92,6 @@
g_return_if_fail(iter != NULL);
dbus_signature = galago_object_type_get_dbus_signature(type);
-
g_return_if_fail(dbus_signature != NULL);
dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
@@ -100,9 +99,8 @@
for (l = list; l != NULL; l = l->next)
{
- GalagoObject *object = (GalagoObject *)l->data;
-
- galago_dbus_message_iter_append_object(&array_iter, object);
+ galago_dbus_message_iter_append_object(&array_iter,
+ GALAGO_OBJECT(l->data));
}
dbus_message_iter_close_container(iter, &array_iter);
@@ -559,7 +557,7 @@
va_list args)
{
DBusMessage *message;
- DBusMessage *reply;
+ DBusMessage *reply = NULL;
DBusMessageIter iter;
DBusError error;
GList *ret_list = NULL, *l;
@@ -570,6 +568,8 @@
galago_goto_if_fail(GALAGO_IS_OBJECT(object), exit);
galago_goto_if_fail(return_types != NULL, exit);
+ dbus_error_init(&error);
+
if (!galago_is_connected())
goto exit;
@@ -578,8 +578,6 @@
galago_goto_if_fail(message != NULL, exit);
- dbus_error_init(&error);
-
reply = dbus_connection_send_with_reply_and_block(
galago_get_dbus_conn(), message, -1, &error);
@@ -607,15 +605,17 @@
dbus_message_iter_next(&iter);
}
- dbus_message_unref(reply);
-
exit:
dbus_error_free(&error);
- for (l = return_types; l != NULL; l = l->next)
- galago_value_destroy((GalagoValue *)l->data);
+ if (reply != NULL)
+ dbus_message_unref(reply);
- g_list_free(return_types);
+ if (return_types != NULL)
+ {
+ g_list_foreach(return_types, (GFunc)galago_value_destroy, NULL);
+ g_list_free(return_types);
+ }
return ret_list;
}
Modified: trunk/libgalago/libgalago/galago-object.c
===================================================================
--- trunk/libgalago/libgalago/galago-object.c 2006-04-02 22:54:35 UTC (rev 2652)
+++ trunk/libgalago/libgalago/galago-object.c 2006-04-02 22:56:56 UTC (rev 2653)
@@ -791,10 +791,9 @@
break;
}
- dbus_message_unref(reply);
-
exit:
dbus_error_free(&error);
+ dbus_message_unref(reply);
return value;
}
Modified: trunk/libgalago/libgalago/galago-service.c
===================================================================
--- trunk/libgalago/libgalago/galago-service.c 2006-04-02 22:54:35 UTC (rev 2652)
+++ trunk/libgalago/libgalago/galago-service.c 2006-04-02 22:56:56 UTC (rev 2653)
@@ -169,12 +169,8 @@
galago_context_remove_service(service);
galago_context_pop();
- if (service->priv->id != NULL)
- g_free(service->priv->id);
-
- if (service->priv->name != NULL)
- g_free(service->priv->name);
-
+ g_free(service->priv->id);
+ g_free(service->priv->name);
g_free(service->priv);
service->priv = NULL;
}
@@ -207,7 +203,7 @@
{
GalagoService *service;
const char *obj_path, *id, *name;
- int flags;
+ dbus_uint32_t flags;
obj_path = galago_dbus_message_iter_get_string_or_nil(iter);
dbus_message_iter_next(iter);
@@ -238,7 +234,7 @@
l != NULL;
l = l->next)
{
- _galago_dbus_service_add_account(service, (GalagoAccount *)l->data);
+ _galago_dbus_service_add_account(service, GALAGO_ACCOUNT(l->data));
}
/* We must go through it a second time. */
@@ -246,8 +242,6 @@
l != NULL;
l = l->next)
{
- account = (GalagoAccount *)l->data;
-
galago_dbus_object_push_full(GALAGO_OBJECT(l->data));
}
}
More information about the galago-commits
mailing list