summaryrefslogtreecommitdiff
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
authorM Stoeckl <[email protected]>2019-01-10 18:27:21 -0500
committerM Stoeckl <[email protected]>2019-01-14 08:05:29 -0500
commit2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 (patch)
tree56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/swap.c
parent6d392150a72ecc3b69fcfb48865f625e2c7b79d6 (diff)
Remove now-unused "input" argument of cmd_results_new
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index 670d6bca..a8beb162 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -11,7 +11,7 @@
#include "sway/tree/workspace.h"
#include "stringop.h"
-static const char* EXPECTED_SYNTAX =
+static const char expected_syntax[] =
"Expected 'swap container with id|con_id|mark <arg>'";
static void swap_places(struct sway_container *con1,
@@ -171,12 +171,12 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
return error;
}
if (!root->outputs->length) {
- return cmd_results_new(CMD_INVALID, "swap",
+ return cmd_results_new(CMD_INVALID,
"Can't run this command while there's no outputs connected.");
}
if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) {
- return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX);
+ return cmd_results_new(CMD_INVALID, expected_syntax);
}
struct sway_container *current = config->handler_context.container;
@@ -195,21 +195,21 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
other = root_find_container(test_mark, value);
} else {
free(value);
- return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX);
+ return cmd_results_new(CMD_INVALID, expected_syntax);
}
if (!other) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Failed to find %s '%s'", argv[2], value);
} else if (!current) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Can only swap with containers and views");
} else if (container_has_ancestor(current, other)
|| container_has_ancestor(other, current)) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Cannot swap ancestor and descendant");
} else if (container_is_floating(current) || container_is_floating(other)) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Swapping with floating containers is not supported");
}
@@ -226,5 +226,5 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
arrange_node(node_get_parent(&other->node));
}
- return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+ return cmd_results_new(CMD_SUCCESS, NULL);
}