summaryrefslogtreecommitdiff
path: root/libusb/os/poll_windows.c
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-04-10 13:05:37 +0100
committerPete Batard <pete@akeo.ie>2012-04-10 13:05:37 +0100
commit24d595aa71e7fd0f14d40e933a33f852f7269c8b (patch)
treec3fe4d26efb42bd6a0aa99f6c9032971697de118 /libusb/os/poll_windows.c
parent37dfd16c8c2f36c81c86de303072def0dc405e32 (diff)
downloadlibusb-24d595aa71e7fd0f14d40e933a33f852f7269c8b.tar.gz
Windows: misc improvements
* prefer calloc over malloc * silence VS2010 intellisense warnings on mem allocation * other minor fixes and formatting improvements to align with -pbatard
Diffstat (limited to 'libusb/os/poll_windows.c')
-rw-r--r--libusb/os/poll_windows.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c
index 5204bcb..2201ffa 100644
--- a/libusb/os/poll_windows.c
+++ b/libusb/os/poll_windows.c
@@ -182,7 +182,7 @@ int _fd_to_index_and_lock(int fd)
OVERLAPPED *create_overlapped(void)
{
- OVERLAPPED *overlapped = calloc(1, sizeof(OVERLAPPED));
+ OVERLAPPED *overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
if (overlapped == NULL) {
return NULL;
}
@@ -274,7 +274,7 @@ int usbi_pipe(int filedes[2])
CHECK_INIT_POLLING;
- overlapped = calloc(1, sizeof(OVERLAPPED));
+ overlapped = (OVERLAPPED*) calloc(1, sizeof(OVERLAPPED));
if (overlapped == NULL) {
return -1;
}
@@ -572,8 +572,8 @@ int usbi_poll(struct pollfd *fds, unsigned int nfds, int timeout)
CHECK_INIT_POLLING;
triggered = 0;
- handles_to_wait_on = malloc((nfds+1)*sizeof(HANDLE)); // +1 for fd_update
- handle_to_index = malloc(nfds*sizeof(int));
+ handles_to_wait_on = (HANDLE*) calloc(nfds+1, sizeof(HANDLE)); // +1 for fd_update
+ handle_to_index = (int*) calloc(nfds, sizeof(int));
if ((handles_to_wait_on == NULL) || (handle_to_index == NULL)) {
errno = ENOMEM;
triggered = -1;