diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-12-08 23:55:14 +0000 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-12-09 01:15:38 +0000 |
commit | c8776fac4232f9faab0a78ef3e18dc4366496421 (patch) | |
tree | 028fbc584d233a7a934feb0b6807c9a988c8e7f1 /sway/commands | |
parent | 19e831ed3da2aba75d56e46c57967bcc60442d57 (diff) |
Cleanup list code
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/bar/modifier.c | 1 | ||||
-rw-r--r-- | sway/commands/bind.c | 8 |
2 files changed, 2 insertions, 7 deletions
diff --git a/sway/commands/bar/modifier.c b/sway/commands/bar/modifier.c index 09025fff..1b3e7492 100644 --- a/sway/commands/bar/modifier.c +++ b/sway/commands/bar/modifier.c @@ -20,7 +20,6 @@ struct cmd_results *bar_cmd_modifier(int argc, char **argv) { uint32_t tmp_mod; if ((tmp_mod = get_modifier_mask_by_name(split->items[i])) > 0) { mod |= tmp_mod; - continue; } else { error = cmd_results_new(CMD_INVALID, "modifier", "Unknown modifier '%s'", split->items[i]); diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 52a245fa..886a262c 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -78,7 +78,6 @@ static int key_qsort_cmp(const void *keyp_a, const void *keyp_b) { return (key_a < key_b) ? -1 : ((key_a > key_b) ? 1 : 0); } - /** * From a keycode, bindcode, or bindsym name and the most likely binding type, * identify the appropriate numeric value corresponding to the key. Return NULL @@ -278,7 +277,6 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'", bindtype, argv[0], binding->command, binding->input); return cmd_results_new(CMD_SUCCESS, NULL, NULL); - } struct cmd_results *cmd_bindsym(int argc, char **argv) { @@ -289,7 +287,6 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) { return cmd_bindsym_or_bindcode(argc, argv, true); } - /** * Execute the command associated to a binding */ @@ -299,15 +296,14 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) config->handler_context.seat = seat; list_t *res_list = execute_command(binding->command, NULL, NULL); bool success = true; - while (res_list->length) { - struct cmd_results *results = res_list->items[0]; + for (int i = 0; i < res_list->length; ++i) { + struct cmd_results *results = res_list->items[i]; if (results->status != CMD_SUCCESS) { wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)", binding->command, results->error); success = false; } free_cmd_results(results); - list_del(res_list, 0); } list_free(res_list); if (success) { |