[PATCH obexd v0 2/3] client: Remove obc_transfer_abort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

Refactor the code to remove function obc_transfer_abort, which is used
only once and is anyway coupled to the D-Bus API.
---
 client/transfer.c |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/client/transfer.c b/client/transfer.c
index 0686afe..f296638 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -187,20 +187,6 @@ static void abort_complete(GObex *obex, GError *err, gpointer user_data)
 	}
 }
 
-static gboolean obc_transfer_abort(struct obc_transfer *transfer)
-{
-	if (transfer->xfer == 0)
-		return FALSE;
-
-	if (transfer->progress_id != 0) {
-		g_source_remove(transfer->progress_id);
-		transfer->progress_id = 0;
-	}
-
-	return g_obex_cancel_transfer(transfer->xfer, abort_complete,
-								transfer);
-}
-
 static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
 					DBusMessage *message, void *user_data)
 {
@@ -218,7 +204,17 @@ static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
 				ERROR_INTERFACE ".InProgress",
 				"Cancellation already in progress");
 
-	if (!obc_transfer_abort(transfer))
+	if (transfer->xfer == 0)
+		return g_dbus_create_error(message,
+				ERROR_INTERFACE ".Failed",
+				"Failed");
+
+	if (transfer->progress_id != 0) {
+		g_source_remove(transfer->progress_id);
+		transfer->progress_id = 0;
+	}
+
+	if (!g_obex_cancel_transfer(transfer->xfer, abort_complete, transfer))
 		return g_dbus_create_error(message,
 				ERROR_INTERFACE ".Failed",
 				"Failed");
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux