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/main.c | |
parent | 19e831ed3da2aba75d56e46c57967bcc60442d57 (diff) |
Cleanup list code
Diffstat (limited to 'sway/main.c')
-rw-r--r-- | sway/main.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sway/main.c b/sway/main.c index a74183fe..f70e751d 100644 --- a/sway/main.c +++ b/sway/main.c @@ -393,13 +393,12 @@ int main(int argc, char **argv) { while (config->cmd_queue->length) { char *line = config->cmd_queue->items[0]; list_t *res_list = execute_command(line, NULL, NULL); - while (res_list->length) { - struct cmd_results *res = res_list->items[0]; + for (int i = 0; i < res_list->length; ++i) { + struct cmd_results *res = res_list->items[i]; if (res->status != CMD_SUCCESS) { wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error); } free_cmd_results(res); - list_del(res_list, 0); } list_free(res_list); free(line); |