diff options
author | M Stoeckl <[email protected]> | 2019-01-10 18:27:21 -0500 |
---|---|---|
committer | M Stoeckl <[email protected]> | 2019-01-14 08:05:29 -0500 |
commit | 2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 (patch) | |
tree | 56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/workspace.c | |
parent | 6d392150a72ecc3b69fcfb48865f625e2c7b79d6 (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/workspace.c')
-rw-r--r-- | sway/commands/workspace.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 211b344d..6bfca506 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c @@ -58,7 +58,7 @@ static void prevent_invalid_outer_gaps(struct workspace_config *wsc) { static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, int gaps_location) { - const char *expected = "Expected 'workspace <name> gaps " + const char expected[] = "Expected 'workspace <name> gaps " "inner|outer|horizontal|vertical|top|right|bottom|left <px>'"; struct cmd_results *error = NULL; if ((error = checkarg(argc, "workspace", EXPECTED_EQUAL_TO, @@ -69,7 +69,7 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, struct workspace_config *wsc = workspace_config_find_or_create(ws_name); free(ws_name); if (!wsc) { - return cmd_results_new(CMD_FAILURE, "workspace gaps", + return cmd_results_new(CMD_FAILURE, "Unable to allocate workspace output"); } @@ -77,7 +77,7 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, int amount = strtol(argv[gaps_location + 2], &end, 10); if (strlen(end)) { free(end); - return cmd_results_new(CMD_FAILURE, "workspace gaps", expected); + return cmd_results_new(CMD_FAILURE, expected); } bool valid = false; @@ -108,7 +108,7 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, } } if (!valid) { - return cmd_results_new(CMD_INVALID, "workspace gaps", expected); + return cmd_results_new(CMD_INVALID, expected); } // Prevent invalid gaps configurations. @@ -150,7 +150,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { struct workspace_config *wsc = workspace_config_find_or_create(ws_name); free(ws_name); if (!wsc) { - return cmd_results_new(CMD_FAILURE, "workspace output", + return cmd_results_new(CMD_FAILURE, "Unable to allocate workspace output"); } for (int i = output_location + 1; i < argc; ++i) { @@ -162,9 +162,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { } } else { if (config->reading || !config->active) { - return cmd_results_new(CMD_DEFER, "workspace", NULL); + return cmd_results_new(CMD_DEFER, NULL); } else if (!root->outputs->length) { - return cmd_results_new(CMD_INVALID, "workspace", + return cmd_results_new(CMD_INVALID, "Can't run this command while there's no outputs connected."); } @@ -181,11 +181,11 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { struct sway_workspace *ws = NULL; if (strcasecmp(argv[0], "number") == 0) { if (argc < 2) { - return cmd_results_new(CMD_INVALID, "workspace", + return cmd_results_new(CMD_INVALID, "Expected workspace number"); } if (!isdigit(argv[1][0])) { - return cmd_results_new(CMD_INVALID, "workspace", + return cmd_results_new(CMD_INVALID, "Invalid workspace number '%s'", argv[1]); } if (!(ws = workspace_by_number(argv[1]))) { @@ -202,7 +202,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { } else if (strcasecmp(argv[0], "back_and_forth") == 0) { struct sway_seat *seat = config->handler_context.seat; if (!seat->prev_workspace_name) { - return cmd_results_new(CMD_INVALID, "workspace", + return cmd_results_new(CMD_INVALID, "There is no previous workspace"); } if (!(ws = workspace_by_name(argv[0]))) { @@ -218,5 +218,5 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { workspace_switch(ws, no_auto_back_and_forth); seat_consider_warp_to_focus(config->handler_context.seat); } - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } |