[PATCH v3 2/3] POSIX Asynchronous I/O support: fhandler files

Mark Geisert mark@maxrnd.com
Wed Jul 18 05:30:00 GMT 2018


Corinna Vinschen wrote:
> On Jul 15 01:20, Mark Geisert wrote:
>> +      if (aio)
>> +	status = NtReadFile (prw_handle, aiocb->aio_win_event, NULL, NULL,
>> +			     &aiocb->aio_win_iosb, buf, count, &off, NULL);
>> +      else
>> +	status = NtReadFile (prw_handle, NULL, NULL, NULL, &io, buf, count,
>> +			     &off, NULL);
>
> Ok, this is a very personal style issue, but I don't like to see the same
> function called just with slightly different parameters in an if/else.
> Would you mind terribly to rewrite this kind of like
>
>   HANDLE evt = aio ? aiocb->aio_win_event : NULL;
>   PIO_STATUS_BLOCK pio = aio ? &aiocb->aio_win_iosb : NULL;
>
>   [...]
>
>   status = NtReadFile (prw_handle, evt, NULL, NULL, pio, buf, count,
> 		       &off, NULL);
>
> ?

I agree your code is more readable and maintainable.  I plead excess reverence 
for the original code :-().  All three locations have now been re-coded in the 
improved manner.

..mark



More information about the Cygwin-patches mailing list