summaryrefslogtreecommitdiff
path: root/libusb/os/poll_windows.c
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2020-01-25 12:10:04 -0800
committerChris Dickens <christopher.a.dickens@gmail.com>2020-01-25 12:10:04 -0800
commit7bc0ff3ce94572f3e52718938e4beb4c7a86bfff (patch)
treed94640a7edf402b2373b5cc4cfb84881e9c4bfb6 /libusb/os/poll_windows.c
parent221e8196221a6ede462914daf6c2652d57843df6 (diff)
downloadlibusb-7bc0ff3ce94572f3e52718938e4beb4c7a86bfff.tar.gz
core: Convert internal macros to static inline functions
Older versions of the Visual Studio compiler are picky about macros constructed with the 'do { ... } while (0)' construct. Convert these internal ones to static inline functions. The result is functionally equivalent but gets us type checking and a bit more readability. Also address some compiler warnings due to some header files that are being included in a different order than before. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/poll_windows.c')
-rw-r--r--libusb/os/poll_windows.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c
index bd8ac67..afcc233 100644
--- a/libusb/os/poll_windows.c
+++ b/libusb/os/poll_windows.c
@@ -34,17 +34,15 @@
* with a fake pipe. The read/write functions are only meant to be used in that
* context.
*/
-#include <config.h>
-#include <assert.h>
+#include "libusbi.h"
+
#include <errno.h>
#include <intrin.h>
#include <malloc.h>
+#include <stdbool.h>
#include <stdlib.h>
-#include "libusbi.h"
-#include "windows_common.h"
-
// public fd data
const struct winfd INVALID_WINFD = { -1, NULL };
@@ -135,7 +133,7 @@ static int install_fd(struct file_descriptor *fd)
for (n = 0; n < fd_table_size; n += BITMAP_BITS_PER_WORD) {
unsigned int idx = n / BITMAP_BITS_PER_WORD;
- unsigned long mask, pos;
+ unsigned long mask, pos = 0UL;
mask = ~fd_table_bitmap[idx];
if (mask == 0UL)