diff --git a/common/list.c b/common/list.c index 16b5629a0..feaf8abf7 100644 --- a/common/list.c +++ b/common/list.c @@ -211,7 +211,7 @@ ssize_t list_lsearch(const list_t *list, int compare(const void *key, const void uint8_t (*array)[size] = list->items; for (size_t i = 0; i < list->length; ++i) { - if (compare(key, &array[i]) == 0) { + if (compare(&key, &array[i]) == 0) { if (ret) { memcpy(ret, &array[i], size); } diff --git a/sway/config.c b/sway/config.c index d301deea7..12d05dae0 100644 --- a/sway/config.c +++ b/sway/config.c @@ -1230,7 +1230,8 @@ int workspace_output_cmp_workspace(const void *a, const void *b) { } int sway_binding_cmp_keys(const void *key, const void *item) { - const struct sway_binding *binda = item, *bindb = key; + const struct sway_binding *binda = *(struct sway_binding **)item; + const struct sway_binding *bindb = *(struct sway_binding **)key; // Count keys pressed for this binding. important so we check long before // short ones. for example mod+a+b before mod+a @@ -1277,7 +1278,7 @@ int sway_binding_cmp_keys(const void *key, const void *item) { int sway_binding_cmp(const void *a, const void *b) { int cmp = 0; - if ((cmp = sway_binding_cmp_keys(a, b)) != 0) { + if ((cmp = sway_binding_cmp_keys(&a, &b)) != 0) { return cmp; } const struct sway_binding *binda = a, *bindb = b; diff --git a/sway/container.c b/sway/container.c index f25fccb41..6767b5034 100644 --- a/sway/container.c +++ b/sway/container.c @@ -373,7 +373,7 @@ swayc_t *new_floating_view(wlc_handle handle) { view->is_floating = true; // Case of focused workspace, just create as child of it - list_add(swayc_active_workspace()->floating, view); + list_add(swayc_active_workspace()->floating, &view); view->parent = swayc_active_workspace(); if (swayc_active_workspace()->focused == NULL) { set_focused_container_for(swayc_active_workspace(), view); diff --git a/sway/criteria.c b/sway/criteria.c index d5a580e2f..83a4993ec 100644 --- a/sway/criteria.c +++ b/sway/criteria.c @@ -376,7 +376,7 @@ list_t *criteria_for(swayc_t *cont) { for (size_t i = 0; i < config->criteria->length; i++) { struct criteria *bc = *(struct criteria **)list_get(config->criteria, i); if (criteria_test(cont, bc->tokens)) { - list_add(matches, bc); + list_add(matches, &bc); } } return matches; @@ -390,7 +390,7 @@ struct list_tokens { static void container_match_add(swayc_t *container, void *arg) { struct list_tokens *list_tokens = arg; if (criteria_test(container, list_tokens->tokens)) { - list_add(list_tokens->list, container); + list_add(list_tokens->list, &container); } } list_t *container_for(list_t *tokens) { diff --git a/sway/extensions.c b/sway/extensions.c index 38f8db717..f93d0d8b2 100644 --- a/sway/extensions.c +++ b/sway/extensions.c @@ -28,7 +28,7 @@ static struct panel_config *find_or_create_panel_config(struct wl_resource *reso sway_log(L_ERROR, "Unable to create panel config"); return NULL; } - list_add(desktop_shell.panels, config); + list_add(desktop_shell.panels, &config); config->wl_resource = resource; return config; } @@ -101,7 +101,7 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc config->output = output; config->surface = wlc_resource_from_wl_surface_resource(surface); config->wl_surface_res = surface; - list_add(desktop_shell.backgrounds, config); + list_add(desktop_shell.backgrounds, &config); wl_resource_set_destructor(surface, background_surface_destructor); arrange_windows(swayc_by_handle(output), -1, -1); wlc_output_schedule_render(config->output); @@ -211,7 +211,7 @@ static void set_lock_surface(struct wl_client *client, struct wl_resource *resou desktop_shell.is_locked = true; input_init(); arrange_windows(workspace, -1, -1); - list_add(desktop_shell.lock_surfaces, surface); + list_add(desktop_shell.lock_surfaces, &surface); wl_resource_set_destructor(surface, lock_surface_destructor); } else { sway_log(L_ERROR, "Attempted to set lock surface to non-view"); diff --git a/sway/handlers.c b/sway/handlers.c index b7936942f..f0b714b92 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -1008,7 +1008,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w swayc_t *item = *(swayc_t **)list_get(pointer->parent->floating, i); if (item == pointer) { list_delete(pointer->parent->floating, i); - list_add(pointer->parent->floating, pointer); + list_add(pointer->parent->floating, &pointer); break; } } diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 41951bbae..4464c5e34 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -286,7 +286,7 @@ void ipc_get_pixels(wlc_handle output) { for (size_t i = 0; i < ipc_get_pixel_requests->length; ++i) { req = *(struct get_pixels_request **)list_get(ipc_get_pixel_requests, i); if (req->output != output) { - list_add(unhandled, req); + list_add(unhandled, &req); continue; } diff --git a/sway/layout.c b/sway/layout.c index b2eab662b..b2d5cb301 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -63,7 +63,7 @@ int index_child(const swayc_t *child) { void add_child(swayc_t *parent, swayc_t *child) { sway_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", child, child->type, child->width, child->height, parent, parent->type, parent->width, parent->height); - list_add(parent->children, child); + list_add(parent->children, &child); child->parent = parent; // set focus for this container if (!parent->focused) { @@ -140,7 +140,7 @@ void add_floating(swayc_t *ws, swayc_t *child) { if (!sway_assert(ws->type == C_WORKSPACE, "Must be of workspace type")) { return; } - list_add(ws->floating, child); + list_add(ws->floating, &child); child->parent = ws; child->is_floating = true; if (!ws->focused) { @@ -154,19 +154,19 @@ swayc_t *add_sibling(swayc_t *fixed, swayc_t *active) { if (fixed->is_floating) { if (active->is_floating) { int i = index_child(fixed); - list_insert(parent->floating, i + 1, active); + list_insert(parent->floating, i + 1, &active); } else { - list_add(parent->children, active); + list_add(parent->children, &active); } } else { if (active->is_floating) { - list_add(parent->floating, active); + list_add(parent->floating, &active); } else { int i = index_child(fixed); if (is_auto_layout(parent->layout)) { - list_add(parent->children, active); + list_add(parent->children, &active); } else { - list_insert(parent->children, i + 1, active); + list_insert(parent->children, i + 1, &active); } } } diff --git a/swaybar/ipc.c b/swaybar/ipc.c index ebed88586..ec3f81757 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -315,7 +315,7 @@ void ipc_bar_init(struct bar *bar, const char *bar_id) { // add bar to the output struct output *bar_output = new_output(name); bar_output->idx = i; - list_add(bar->outputs, bar_output); + list_add(bar->outputs, &bar_output); } free(res); json_object_put(outputs);