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

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 16 14:27:00 GMT 2018


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

?


> +		  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);

Ditto.

> +      if (aio)
> +	status = NtWriteFile (prw_handle, aiocb->aio_win_event, NULL, NULL,
> +			      &aiocb->aio_win_iosb, buf, count, &off, NULL);
> +      else
> +        status = NtWriteFile (prw_handle, NULL, NULL, NULL, &io, buf, count,
> +			      &off, NULL);

Ditto.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20180716/9ef160b5/attachment.sig>


More information about the Cygwin-patches mailing list