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/mode.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sway/commands/mode.c') diff --git a/sway/commands/mode.c b/sway/commands/mode.c index 189e3c1a..828d77e1 100644 --- a/sway/commands/mode.c +++ b/sway/commands/mode.c @@ -22,16 +22,14 @@ struct cmd_results *cmd_mode(int argc, char **argv) { } if (argc > 1 && !config->reading) { - return cmd_results_new(CMD_FAILURE, - "mode", "Can only be used in config file."); + return cmd_results_new(CMD_FAILURE, "Can only be used in config file"); } bool pango = strcmp(*argv, "--pango_markup") == 0; if (pango) { argc--; argv++; if (argc == 0) { - return cmd_results_new(CMD_FAILURE, "mode", - "Mode name is missing"); + return cmd_results_new(CMD_FAILURE, "Mode name is missing"); } } @@ -50,8 +48,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) { if (!mode && argc > 1) { mode = calloc(1, sizeof(struct sway_mode)); if (!mode) { - return cmd_results_new(CMD_FAILURE, - "mode", "Unable to allocate mode"); + return cmd_results_new(CMD_FAILURE, "Unable to allocate mode"); } mode->name = strdup(mode_name); mode->keysym_bindings = create_list(); @@ -61,8 +58,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) { list_add(config->modes, mode); } if (!mode) { - error = cmd_results_new(CMD_INVALID, - "mode", "Unknown mode `%s'", mode_name); + error = cmd_results_new(CMD_INVALID, "Unknown mode `%s'", mode_name); return error; } if ((config->reading && argc > 1) || (!config->reading && argc == 1)) { @@ -75,7 +71,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) { // trigger IPC mode event ipc_event_mode(config->current_mode->name, config->current_mode->pango); - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } // Create binding -- cgit v1.2.3