From 2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 Mon Sep 17 00:00:00 2001 From: M Stoeckl Date: Thu, 10 Jan 2019 18:27:21 -0500 Subject: 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. --- sway/commands/workspace.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'sway/commands/workspace.c') 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 gaps " + const char expected[] = "Expected 'workspace gaps " "inner|outer|horizontal|vertical|top|right|bottom|left '"; 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); } -- cgit v1.2.3-54-g00ecf