From 59f32bd35384e6a5725693d980087ffffc3cd7c0 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 14 Apr 2011 12:31:45 -0500 Subject: netreg: Refactor register_callback --- src/network.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/network.c') diff --git a/src/network.c b/src/network.c index e1095b48..ac981336 100644 --- a/src/network.c +++ b/src/network.c @@ -217,28 +217,21 @@ static void set_registration_mode(struct ofono_netreg *netreg, int mode) static void register_callback(const struct ofono_error *error, void *data) { struct ofono_netreg *netreg = data; - DBusConnection *conn = ofono_dbus_get_connection(); DBusMessage *reply; - if (netreg->pending == NULL) - goto out; - if (error->type == OFONO_ERROR_TYPE_NO_ERROR) reply = dbus_message_new_method_return(netreg->pending); else reply = __ofono_error_failed(netreg->pending); - g_dbus_send_message(conn, reply); - - dbus_message_unref(netreg->pending); - netreg->pending = NULL; + __ofono_dbus_pending_reply(&netreg->pending, reply); -out: if (netreg->driver->registration_status == NULL) return; netreg->driver->registration_status(netreg, - registration_status_callback, netreg); + registration_status_callback, + netreg); } static struct network_operator_data * -- cgit v1.2.3