From 31681e9400c8cdc1bd59684c3bdbc351b7d3304b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Nov 2012 17:11:38 +0000 Subject: [PATCH 4/6] transaction_free: factor out --- bus/connection.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bus/connection.c b/bus/connection.c index d69758c..4b3d1e7 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -2126,6 +2126,18 @@ bus_transaction_send (BusTransaction *transaction, } static void +transaction_free (BusTransaction *transaction) +{ + DBusMessage *message; + + _dbus_assert (transaction->connections == NULL); + + free_cancel_hooks (transaction); + + dbus_free (transaction); +} + +static void connection_cancel_transaction (DBusConnection *connection, BusTransaction *transaction) { @@ -2163,14 +2175,10 @@ bus_transaction_cancel_and_free (BusTransaction *transaction) while ((connection = _dbus_list_pop_first (&transaction->connections))) connection_cancel_transaction (connection, transaction); - _dbus_assert (transaction->connections == NULL); - _dbus_list_foreach (&transaction->cancel_hooks, cancel_hook_cancel, NULL); - free_cancel_hooks (transaction); - - dbus_free (transaction); + transaction_free (transaction); } static void @@ -2224,11 +2232,7 @@ bus_transaction_execute_and_free (BusTransaction *transaction) while ((connection = _dbus_list_pop_first (&transaction->connections))) connection_execute_transaction (connection, transaction); - _dbus_assert (transaction->connections == NULL); - - free_cancel_hooks (transaction); - - dbus_free (transaction); + transaction_free (transaction); } static void -- 1.7.10.4