summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rosen Penev2020-06-03 15:36:22 -0700
committerGravatar Nikias Bassen2020-12-30 02:33:45 +0100
commit591b4faa4563bafb7fe78c27e3c5718df7bf6eb6 (patch)
tree1938fae3484be5fb5f0e2c2dee728d3a906f8c1b
parentb21f1112bd969920b995f731367c7e3040b214d5 (diff)
downloadlibusbmuxd-591b4faa4563bafb7fe78c27e3c5718df7bf6eb6.tar.gz
libusbmuxd-591b4faa4563bafb7fe78c27e3c5718df7bf6eb6.tar.bz2
Fix inconsistent declarations
[clang-tidy] Found with readability-inconsistent-declaration-parameter-name Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r--common/socket.h8
-rw-r--r--src/libusbmuxd.c28
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);