RE: [PATCH obexd v0 03/11] client: refactor transfer callback use
From: Mikel Astiz <hidden>
Date: 2012-03-19 14:40:20
Hi Luiz,
quoted
-static void obc_transfer_abort(struct obc_transfer *transfer) +static void transfer_notify_progress(struct obc_transfer *transfer){quoted
+ 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. Regarding the early return, I will integrate the change in the next proposal. Cheers, Mikel