From c572176429ba756c5c2227a2108100ea328cee97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ingo=20B=C3=BCrk?= Date: Thu, 5 Mar 2015 14:00:24 +0100 Subject: [PATCH] Use the already existing function to get rid of some code duplication --- src/commands.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/commands.c b/src/commands.c index 0a64b2b8..c41352bd 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1177,28 +1177,13 @@ void cmd_move_con_to_output(I3_CMD, char *name) { HANDLE_EMPTY_MATCH; - /* get the output */ Output *current_output = NULL; - Output *output; - // TODO: fix the handling of criteria TAILQ_FOREACH(current, &owindows, owindows) current_output = get_output_of_con(current->con); - assert(current_output != NULL); - // TODO: clean this up with commands.spec as soon as we switched away from the lex/yacc command parser - if (strcasecmp(name, "up") == 0) - output = get_output_next_wrap(D_UP, current_output); - else if (strcasecmp(name, "down") == 0) - output = get_output_next_wrap(D_DOWN, current_output); - else if (strcasecmp(name, "left") == 0) - output = get_output_next_wrap(D_LEFT, current_output); - else if (strcasecmp(name, "right") == 0) - output = get_output_next_wrap(D_RIGHT, current_output); - else - output = get_output_by_name(name); - + Output *output = get_output_from_string(current_output, name); if (!output) { LOG("No such output found.\n"); ysuccess(false); -- 2.39.5