From 591b4faa4563bafb7fe78c27e3c5718df7bf6eb6 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 3 Jun 2020 15:36:22 -0700 Subject: Fix inconsistent declarations [clang-tidy] Found with readability-inconsistent-declaration-parameter-name Signed-off-by: Rosen Penev --- common/socket.h | 8 ++++---- src/libusbmuxd.c | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/socket.h b/common/socket.h index f510147..9567270 100644 --- a/common/socket.h +++ b/common/socket.h @@ -54,12 +54,12 @@ int socket_accept(int fd, uint16_t port); int socket_shutdown(int fd, int how); int socket_close(int fd); -int socket_receive(int fd, void *data, size_t size); -int socket_peek(int fd, void *data, size_t size); -int socket_receive_timeout(int fd, void *data, size_t size, int flags, +int socket_receive(int fd, void *data, size_t length); +int socket_peek(int fd, void *data, size_t length); +int socket_receive_timeout(int fd, void *data, size_t length, int flags, unsigned int timeout); -int socket_send(int fd, void *data, size_t size); +int socket_send(int fd, void *data, size_t length); void socket_set_verbose(int level); diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index d0cccd1..703bbbe 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -1138,31 +1138,31 @@ static void init_listeners(void) mutex_init(&listener_mutex); } -USBMUXD_API int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *ctx, usbmuxd_event_cb_t callback, void *user_data) +USBMUXD_API int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *context, usbmuxd_event_cb_t callback, void *user_data) { - if (!ctx || !callback) { + if (!context || !callback) { return -EINVAL; } thread_once(&listener_init_once, init_listeners); mutex_lock(&listener_mutex); - *ctx = malloc(sizeof(struct usbmuxd_subscription_context)); - if (!*ctx) { + *context = malloc(sizeof(struct usbmuxd_subscription_context)); + if (!*context) { mutex_unlock(&listener_mutex); LIBUSBMUXD_ERROR("ERROR: %s: malloc failed\n", __func__); return -ENOMEM; } - (*ctx)->callback = callback; - (*ctx)->user_data = user_data; + (*context)->callback = callback; + (*context)->user_data = user_data; - collection_add(&listeners, *ctx); + collection_add(&listeners, *context); if (devmon == THREAD_T_NULL || !thread_alive(devmon)) { mutex_unlock(&listener_mutex); int res = thread_new(&devmon, device_monitor, NULL); if (res != 0) { - free(*ctx); + free(*context); LIBUSBMUXD_DEBUG(1, "%s: ERROR: Could not start device watcher thread!\n", __func__); return res; } @@ -1173,7 +1173,7 @@ USBMUXD_API int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *ctx, us usbmuxd_event_t ev; ev.event = UE_DEVICE_ADD; memcpy(&ev.device, dev, sizeof(usbmuxd_device_info_t)); - (*ctx)->callback(&ev, (*ctx)->user_data); + (*context)->callback(&ev, (*context)->user_data); } } ENDFOREACH mutex_unlock(&listener_mutex); @@ -1182,26 +1182,26 @@ USBMUXD_API int usbmuxd_events_subscribe(usbmuxd_subscription_context_t *ctx, us return 0; } -USBMUXD_API int usbmuxd_events_unsubscribe(usbmuxd_subscription_context_t ctx) +USBMUXD_API int usbmuxd_events_unsubscribe(usbmuxd_subscription_context_t context) { int ret = 0; int num = 0; - if (!ctx) { + if (!context) { return -EINVAL; } mutex_lock(&listener_mutex); - if (collection_remove(&listeners, ctx) == 0) { + if (collection_remove(&listeners, context) == 0) { FOREACH(usbmuxd_device_info_t *dev, &devices) { if (dev) { usbmuxd_event_t ev; ev.event = UE_DEVICE_REMOVE; memcpy(&ev.device, dev, sizeof(usbmuxd_device_info_t)); - (ctx)->callback(&ev, (ctx)->user_data); + (context)->callback(&ev, (context)->user_data); } } ENDFOREACH - free(ctx); + free(context); } num = collection_count(&listeners); mutex_unlock(&listener_mutex); -- cgit v1.1-32-gdbae