From: Michael Stapelberg Date: Fri, 13 Mar 2015 07:54:52 +0000 (-0700) Subject: Merge pull request #1521 from Airblader/feature-use-refactored-function X-Git-Tag: 4.10.1~67 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=c263bb3d2ae73fbec19640934286bd369a5fff23;hp=a5939f3edc6267ecbf06389fd71b4fa0db443350 Merge pull request #1521 from Airblader/feature-use-refactored-function Use the already existing function to get rid of some code duplication --- diff --git a/src/commands.c b/src/commands.c index b3d36f24..f5f8d05c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1155,28 +1155,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);