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/output/background.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sway/commands/output/background.c') diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index 2cd1b76a..ae2f0640 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c @@ -20,14 +20,14 @@ static const char *bg_options[] = { struct cmd_results *output_cmd_background(int argc, char **argv) { if (!config->handler_context.output_config) { - return cmd_results_new(CMD_FAILURE, "output", "Missing output config"); + return cmd_results_new(CMD_FAILURE, "Missing output config"); } if (!argc) { - return cmd_results_new(CMD_INVALID, "output", + return cmd_results_new(CMD_INVALID, "Missing background file or color specification."); } if (argc < 2) { - return cmd_results_new(CMD_INVALID, "output", + return cmd_results_new(CMD_INVALID, "Missing background scaling mode or `solid_color`."); } @@ -57,7 +57,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { } } if (!valid) { - return cmd_results_new(CMD_INVALID, "output", + return cmd_results_new(CMD_INVALID, "Missing background scaling mode."); } @@ -70,7 +70,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { *ptr = '\\'; } if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) { - struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID, "output", + struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID, "Invalid syntax (%s)", src); free(src); wordfree(&p); @@ -81,8 +81,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { wordfree(&p); if (!src) { wlr_log(WLR_ERROR, "Failed to duplicate string"); - return cmd_results_new(CMD_FAILURE, "output", - "Unable to allocate resource"); + return cmd_results_new(CMD_FAILURE, "Unable to allocate resource"); } if (config->reading && *src != '/') { @@ -92,7 +91,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { if (!conf) { wlr_log(WLR_ERROR, "Failed to duplicate string"); free(src); - return cmd_results_new(CMD_FAILURE, "output", + return cmd_results_new(CMD_FAILURE, "Unable to allocate resources"); } @@ -103,7 +102,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { free(rel_path); free(conf); wlr_log(WLR_ERROR, "Unable to allocate memory"); - return cmd_results_new(CMD_FAILURE, "output", + return cmd_results_new(CMD_FAILURE, "Unable to allocate resources"); } -- cgit v1.2.3