[PATCH obexd 3/3] gobex: reduce duplicated code in g_obex_put_req

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

g_obex_put_req is quite similar to g_obex_put_req_pkt so now it just
call it to avoid duplicating this code.
---
 gobex/gobex-transfer.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c
index 692d713..0a7a29f 100644
--- a/gobex/gobex-transfer.c
+++ b/gobex/gobex-transfer.c
@@ -277,32 +277,18 @@ guint g_obex_put_req(GObex *obex, GObexDataProducer data_func,
 			GObexFunc complete_func, gpointer user_data,
 			GError **err, guint8 first_hdr_id, ...)
 {
-	struct transfer *transfer;
 	GObexPacket *req;
 	va_list args;
 
 	g_obex_debug(G_OBEX_DEBUG_TRANSFER, "obex %p", obex);
 
-	transfer = transfer_new(obex, G_OBEX_OP_PUT, complete_func, user_data);
-	transfer->data_producer = data_func;
-
 	va_start(args, first_hdr_id);
 	req = g_obex_packet_new_valist(G_OBEX_OP_PUT, FALSE,
 							first_hdr_id, args);
 	va_end(args);
 
-	g_obex_packet_add_body(req, put_get_data, transfer);
-
-	transfer->req_id = g_obex_send_req(obex, req, FIRST_PACKET_TIMEOUT,
-					transfer_response, transfer, err);
-	if (transfer->req_id == 0) {
-		transfer_free(transfer);
-		return 0;
-	}
-
-	g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id);
-
-	return transfer->id;
+	return g_obex_put_req_pkt(obex, req, data_func, complete_func,
+							user_data, err);
 }
 
 static void transfer_abort_req(GObex *obex, GObexPacket *req, gpointer user_data)
-- 
1.7.7.4

--
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