From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 04/10] plugins: use btd_error_failed()
Date: Mon, 13 Dec 2010 19:33:01 -0200 [thread overview]
Message-ID: <1292275987-13799-5-git-send-email-padovan@profusion.mobi> (raw)
In-Reply-To: <1292275987-13799-4-git-send-email-padovan@profusion.mobi>
---
plugins/service.c | 22 ++++------------------
1 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/plugins/service.c b/plugins/service.c
index a442d53..f44aa92 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -337,17 +337,6 @@ static void exit_callback(DBusConnection *conn, void *user_data)
g_free(user_record);
}
-static inline DBusMessage *failed(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed", "Failed");
-}
-
-static inline DBusMessage *failed_strerror(DBusMessage *msg, int err)
-{
- return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
- "%s", strerror(err));
-}
-
static int add_xml_record(DBusConnection *conn, const char *sender,
struct service_adapter *serv_adapter,
const char *record, dbus_uint32_t *handle)
@@ -412,9 +401,7 @@ static DBusMessage *update_record(DBusConnection *conn, DBusMessage *msg,
if (err < 0) {
sdp_record_free(sdp_record);
error("Failed to update the service record");
- return g_dbus_create_error(msg,
- ERROR_INTERFACE ".Failed",
- "%s", strerror(EIO));
+ return btd_error_failed(msg, strerror(-err));
}
return dbus_message_new_method_return(msg);
@@ -449,9 +436,8 @@ static DBusMessage *update_xml_record(DBusConnection *conn,
if (!sdp_record) {
error("Parsing of XML service record failed");
sdp_record_free(sdp_record);
- return g_dbus_create_error(msg,
- ERROR_INTERFACE ".Failed",
- "%s", strerror(EIO));
+ return btd_error_failed(msg,
+ "Parsing of XML service record failed");
}
return update_record(conn, msg, serv_adapter, handle, sdp_record);
@@ -494,7 +480,7 @@ static DBusMessage *add_service_record(DBusConnection *conn,
sender = dbus_message_get_sender(msg);
err = add_xml_record(conn, sender, serv_adapter, record, &handle);
if (err < 0)
- return failed_strerror(msg, err);
+ return btd_error_failed(msg, strerror(-err));
reply = dbus_message_new_method_return(msg);
if (!reply)
--
1.7.3.2
next prev parent reply other threads:[~2010-12-13 21:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 21:32 [PATCH 00/10] More btd_error_* patches Gustavo F. Padovan
2010-12-13 21:32 ` [PATCH 01/10] Add btd_error_no_such_adapter() Gustavo F. Padovan
2010-12-13 21:32 ` [PATCH 02/10] src: use btd_error_invalid_args() Gustavo F. Padovan
2010-12-13 21:33 ` [PATCH 03/10] Add btd_error_failed() Gustavo F. Padovan
2010-12-13 21:33 ` Gustavo F. Padovan [this message]
2010-12-13 21:33 ` [PATCH 05/10] attrib: use btd_error_failed() Gustavo F. Padovan
2010-12-13 21:33 ` [PATCH 06/10] network: " Gustavo F. Padovan
2010-12-13 21:33 ` [PATCH 07/10] input: " Gustavo F. Padovan
2010-12-13 21:33 ` [PATCH 08/10] audio: " Gustavo F. Padovan
2010-12-13 21:33 ` [PATCH 09/10] serial: " Gustavo F. Padovan
2010-12-13 21:33 ` [PATCH 10/10] src: " Gustavo F. Padovan
2010-12-14 8:56 ` [PATCH 00/10] More btd_error_* patches Johan Hedberg
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=1292275987-13799-5-git-send-email-padovan@profusion.mobi \
--to=padovan@profusion.mobi \
--cc=linux-bluetooth@vger.kernel.org \
/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