Hi Pete,

Am 08.09.2014 19:31, schrieb Pete Zaitcev:
> On Sat, 06 Sep 2014 16:06:28 +0200
> Alexander Kurpiers <[email protected]> wrote:
>
>> Next try...
> Looks good as far as general structure goes. Style is a little odd,
> perhaps. For example, /* Check the error code. */ comment is useless,
> straight from the book of "a=b; /* assign a value of b to a */".

True - I left that from the original code. Could indeed be removed - and
a command added instead about moving of

dev->async_status = RTLSDR_RUNNING;

which is necessary  (otherwise the thread does not stop despite the
error returned...).


> When you unroll, the ideom is  while(i--). If you hide the decrement
> inside a [] inside the loop body, it's liable to get missed one day.

Also true, but would need to be --i>=0, as i is the index of an entry
that is already NULL. Not sure if that is nicer.
I have not checked what the libusb_free_transfer() does if called with
NULL. At least for v1.0 it seems ok
(http://libusb.sourceforge.net/api-1.0/group__asyncio.html#ga6ab8b2cff4de9091298a06b2f4b86cd6)
If that works for all variants of libusb, memset'ing after malloc (or
calloc?) to zero the pointers and calling _rtlsdr_free_async_buffers()
may be easier than unrolling (less code duplication).


> But I'll let the maintainer take issues with style. You got the gist
> of it right, I think.
>

Thanks ;-)

Yet I would prefer a comment on patch 3 - that's the only one that I'm
really interested in.
This one is only to port all the changes between Leif's code and the
current git code.

Regards,

Alexander


Reply via email to