From 307f3f4289f1d4883aab3d2c4c09322f328c857a Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 17 Mar 2010 14:59:20 +0000 Subject: readability improvements in poll_windows.c --- libusb/os/poll_windows.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c index dee5cac..234edcd 100644 --- a/libusb/os/poll_windows.c +++ b/libusb/os/poll_windows.c @@ -143,6 +143,7 @@ static volatile LONG compat_spinlock = 0; // a single transfer (OVERLAPPED) when used. As it may not be part of any of the // platform headers, we hook into the Kernel32 system DLL directly to seek it. static BOOL (__stdcall *pCancelIoEx)(HANDLE, LPOVERLAPPED) = NULL; +#define CancelIoEx_Available (pCancelIoEx != NULL) __inline BOOL cancel_io(int index) { if ((index < 0) || (index >= MAX_FDS)) { @@ -153,7 +154,7 @@ __inline BOOL cancel_io(int index) || (poll_fd[index].handle == 0) || (poll_fd[index].overlapped == NULL) ) { return TRUE; } - if (pCancelIoEx != NULL) { + if (CancelIoEx_Available) { return (*pCancelIoEx)(poll_fd[index].handle, poll_fd[index].overlapped); } if (_poll_fd[index].thread_id == GetCurrentThreadId()) { @@ -175,7 +176,7 @@ void init_polling(void) pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED)) GetProcAddress(GetModuleHandle("KERNEL32"), "CancelIoEx"); usbi_dbg("Will use CancelIo%s for I/O cancellation", - (pCancelIoEx != NULL)?"Ex":""); + CancelIoEx_Available?"Ex":""); for (i=0; i