Re: [PATCH obexd v0 03/11] client: refactor transfer callback use

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

 



Hi Mikel,

On Mon, Mar 19, 2012 at 11:40 AM, Mikel Astiz <Mikel.Astiz@xxxxxxxxxxxx> wrote:
> Hi Luiz,
>
>> >
>> > -static void obc_transfer_abort(struct obc_transfer *transfer)
>> > +static void transfer_notify_progress(struct obc_transfer *transfer)
>> {
>> > +       struct transfer_callback *callback = transfer->callback;
>> > +
>> > +       DBG("%p", transfer);
>> > +
>> > +       if ((callback != NULL) && (transfer->transferred !=
>> > +transfer->size))
>> > +               callback->func(transfer, transfer->transferred, NULL,
>> > +
>> > +callback->data); }
>>
>> Usually we use early returns and simple statements to be more readable,
>> so if (callback == NULL) return would have been better. Also I guess we
>> don't really need this check for transferred != size since gobex has a
>> complete callback and latter you set it to NULL.
>>
>
> This patch was refactoring code so the size check has been kept there, exactly as it was.
>
> We can try to drop it if you want, but I guess it would be in another patch. However I think it's actually necessary.

I guess that was to prevent sending the same progress twice, once in
progress and another one in complete, so maybe it is fine to keep it
for now, but perhaps when we are changing the API we should have a
separated signal when the transfer is complete to match gobex.

-- 
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