summaryrefslogtreecommitdiff
path: root/libusb/io.c
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2020-04-27 18:43:42 -0700
committerChris Dickens <christopher.a.dickens@gmail.com>2020-04-27 18:43:42 -0700
commita157b55656e7130c4ea118abcb1dfad21db428b8 (patch)
tree931ee516fe8c35b1361052d21a9ce57335cebaa3 /libusb/io.c
parentfc5132ca74d4a6fc9a8ae942451bc107b25497be (diff)
downloadlibusb-a157b55656e7130c4ea118abcb1dfad21db428b8.tar.gz
core: Fix some minor inconsistencies in API and coding
All of the API functions should take the typedef'ed versions of the opaque libusb structures, but some recent additions to the API did not follow this convention. Fix this by making the changes to the declarations and definitions of the functions. Make the placement of the asterisk in pointer variable declarations consistent (always with the variable name, not the type). Remove some unnecessary casts and initializations relating to dynamically allocated memory. While at it, make casts within the core library consistent in style with no space after the closing parenthesis of the cast. Most of the core already used this style. When using the 'sizeof' operator, dereference the pointer instead of using the type. Most of the core was already doing this, so fix up the few places that weren't. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/io.c')
-rw-r--r--libusb/io.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libusb/io.c b/libusb/io.c
index 907d28e..b969633 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -2079,7 +2079,7 @@ static int handle_timerfd_trigger(struct libusb_context *ctx)
if (r < 0)
goto out;
- /* arm for next timeout*/
+ /* arm for next timeout */
r = arm_timerfd_for_next_timeout(ctx);
out:
@@ -2780,12 +2780,12 @@ const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds(
goto out;
list_for_each_entry(ipollfd, &ctx->ipollfds, list, struct usbi_pollfd)
- ret[i++] = (struct libusb_pollfd *) ipollfd;
+ ret[i++] = (struct libusb_pollfd *)ipollfd;
ret[ctx->pollfds_cnt] = NULL;
out:
usbi_mutex_unlock(&ctx->event_data_lock);
- return (const struct libusb_pollfd **) ret;
+ return (const struct libusb_pollfd **)ret;
#else
usbi_err(ctx, "external polling of libusb's internal descriptors "\
"is not yet supported on Windows platforms");
@@ -2860,5 +2860,4 @@ void usbi_handle_disconnect(struct libusb_device_handle *dev_handle)
usbi_mutex_unlock(&to_cancel->lock);
usbi_handle_transfer_completion(to_cancel, LIBUSB_TRANSFER_NO_DEVICE);
}
-
}