diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2012-12-21 12:25:02 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-12-22 00:15:45 +0200 |
commit | ec258221787476576f8f592e1f04ba198c64bb67 (patch) | |
tree | 7a0f765c137136b7cb169f04be30633528545e27 /obexd/plugins | |
parent | 87810bc8b018f6699c3ba917924782e79a402951 (diff) | |
download | bluez-ec258221787476576f8f592e1f04ba198c64bb67.tar.gz |
obexd: Simplify org.bluez.Error.InvalidArguments handling
Use a helper function to void code duplication.
Diffstat (limited to 'obexd/plugins')
-rw-r--r-- | obexd/plugins/bluetooth.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c index 8985c8309..e28a94fab 100644 --- a/obexd/plugins/bluetooth.c +++ b/obexd/plugins/bluetooth.c @@ -104,6 +104,12 @@ drop: return; } +static DBusMessage *invalid_args(DBusMessage *msg) +{ + return g_dbus_create_error(msg, "org.bluez.Error.InvalidArguments", + "Invalid arguments in method call"); +} + static DBusMessage *profile_new_connection(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -115,26 +121,20 @@ static DBusMessage *profile_new_connection(DBusConnection *conn, dbus_message_iter_init(msg, &args); if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) - return g_dbus_create_error(msg, - "org.bluez.Error.InvalidArguments", - "Invalid arguments in method call"); + return invalid_args(msg); dbus_message_iter_get_basic(&args, &device); dbus_message_iter_next(&args); if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_UNIX_FD) - return g_dbus_create_error(msg, - "org.bluez.Error.InvalidArguments", - "Invalid arguments in method call"); + return invalid_args(msg); dbus_message_iter_get_basic(&args, &fd); io = g_io_channel_unix_new(fd); if (io == NULL) - return g_dbus_create_error(msg, - "org.bluez.Error.InvalidArguments", - "Invalid arguments in method call"); + return invalid_args(msg); DBG("device %s", device); |