Re: [PATCH BlueZ 1/2] gdbus/client: Use g_dbus_send_message if callback is not set

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

 



Hi,

On Tue, Mar 8, 2016 at 3:18 PM, Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> If the user don't set a function it means it doesn't care about the reply
> so g_dbus_send_message can be used.
> ---
>  gdbus/client.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/gdbus/client.c b/gdbus/client.c
> index 068e778..a011e19 100644
> --- a/gdbus/client.c
> +++ b/gdbus/client.c
> @@ -853,28 +853,30 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
>         if (client == NULL)
>                 return FALSE;
>
> -       data = g_try_new0(struct method_call_data, 1);
> -       if (data == NULL)
> -               return FALSE;
> -
> -       data->function = function;
> -       data->user_data = user_data;
> -       data->destroy = destroy;
> -
>         msg = dbus_message_new_method_call(client->service_name,
>                                 proxy->obj_path, proxy->interface, method);
> -       if (msg == NULL) {
> -               g_free(data);
> +       if (msg == NULL)
>                 return FALSE;
> -       }
>
>         if (setup) {
>                 DBusMessageIter iter;
>
>                 dbus_message_iter_init_append(msg, &iter);
> -               setup(&iter, data->user_data);
> +               setup(&iter, user_data);
>         }
>
> +       if (!function)
> +               return g_dbus_send_message(client->dbus_conn, msg);
> +
> +       data = g_try_new0(struct method_call_data, 1);
> +       if (data == NULL)
> +               return FALSE;
> +
> +       data->function = function;
> +       data->user_data = user_data;
> +       data->destroy = destroy;
> +
> +
>         if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
>                                         &call, METHOD_CALL_TIMEOUT) == FALSE) {
>                 dbus_message_unref(msg);
> --
> 2.5.0

Applied.


-- 
Luiz Augusto von Dentz
--
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