adapter: Use g_dbus_send_reply whenever possible 91/204891/1
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 31 Jan 2018 10:55:30 +0000 (08:55 -0200)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 15 Apr 2019 03:23:45 +0000 (08:53 +0530)
This convert calls of g_dbus_create_reply + g_dbus_send_message to just
g_dbus_send_reply as that is simpler to maintain and saver as that always
check if the reply could be constructed properly.

Change-Id: I7514f10f22e4c629892796c929cb556a0fb07a97
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/adapter.c

index de5bdee..f9dca5f 100644 (file)
@@ -1992,9 +1992,8 @@ static void start_discovery_complete(uint8_t status, uint16_t length,
                        adapter->filtered_discovery = false;
 
                if (client->msg) {
-                       reply = g_dbus_create_reply(client->msg,
-                                                       DBUS_TYPE_INVALID);
-                       g_dbus_send_message(dbus_conn, reply);
+                       g_dbus_send_reply(dbus_conn, client->msg,
+                                               DBUS_TYPE_INVALID);
                        dbus_message_unref(client->msg);
                        client->msg = NULL;
                }
@@ -2657,10 +2656,8 @@ static void stop_discovery_complete(uint8_t status, uint16_t length,
                goto done;
        }
 
-       if (client->msg) {
-               reply = g_dbus_create_reply(client->msg, DBUS_TYPE_INVALID);
-               g_dbus_send_message(dbus_conn, reply);
-       }
+       if (client->msg)
+               g_dbus_send_reply(dbus_conn, client->msg, DBUS_TYPE_INVALID);
 
        adapter->discovery_type = 0x00;
        adapter->discovery_enable = 0x00;