linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH obexd 3/3] client: simplify obc_session_pull
Date: Fri,  2 Mar 2012 13:41:27 +0100	[thread overview]
Message-ID: <1330692087-13021-4-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1330692087-13021-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

Functions obc_session_get and obc_session_pull nearly share the same
code, so the later can be achieved by just calling the first one.

The session api is not modified in this patch.
---
 client/session.c |   22 +---------------------
 1 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/client/session.c b/client/session.c
index 6497d70..595f684 100644
--- a/client/session.c
+++ b/client/session.c
@@ -1001,27 +1001,7 @@ int obc_session_pull(struct obc_session *session,
 				const char *type, const char *targetfile,
 				session_callback_t function, void *user_data)
 {
-	struct obc_transfer *transfer;
-	const char *agent;
-
-	if (session->obex == NULL)
-		return -ENOTCONN;
-
-	if (session->agent != NULL)
-		agent = obc_agent_get_name(session->agent);
-	else
-		agent = NULL;
-
-	transfer = obc_transfer_register(session->conn, session->obex,
-								agent,
-								targetfile,
-								NULL, type,
-								NULL);
-	if (transfer == NULL) {
-		return -EIO;
-	}
-
-	return session_request(session, transfer, session_prepare_get,
+	return obc_session_get(session, type, NULL, targetfile, NULL, 0,
 							function, user_data);
 }
 
-- 
1.7.6.5


  parent reply	other threads:[~2012-03-02 12:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02 12:41 [PATCH obexd 0/3] client: parameter naming convention Mikel Astiz
2012-03-02 12:41 ` [PATCH obexd 1/3] client: fix naming convention in transfer api Mikel Astiz
2012-03-05 10:14   ` Luiz Augusto von Dentz
2012-03-02 12:41 ` [PATCH obexd 2/3] client: refactor naming convention in session api Mikel Astiz
2012-03-05 10:17   ` Luiz Augusto von Dentz
2012-03-02 12:41 ` Mikel Astiz [this message]
2012-03-05 10:18   ` [PATCH obexd 3/3] client: simplify obc_session_pull Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330692087-13021-4-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).