aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/output/mode.c
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-10 18:27:21 -0500
committerLibravatar M Stoeckl <code@mstoeckl.com>2019-01-14 08:05:29 -0500
commit2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 (patch)
tree56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/output/mode.c
parentRemove 'input' field of IPC command return json (diff)
downloadsway-2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0.tar.gz
sway-2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0.tar.zst
sway-2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0.zip
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/output/mode.c')
-rw-r--r--sway/commands/output/mode.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sway/commands/output/mode.c b/sway/commands/output/mode.c
index ef56ae9e..bcfce372 100644
--- a/sway/commands/output/mode.c
+++ b/sway/commands/output/mode.c
@@ -4,10 +4,10 @@
4 4
5struct cmd_results *output_cmd_mode(int argc, char **argv) { 5struct cmd_results *output_cmd_mode(int argc, char **argv) {
6 if (!config->handler_context.output_config) { 6 if (!config->handler_context.output_config) {
7 return cmd_results_new(CMD_FAILURE, "output", "Missing output config"); 7 return cmd_results_new(CMD_FAILURE, "Missing output config");
8 } 8 }
9 if (!argc) { 9 if (!argc) {
10 return cmd_results_new(CMD_INVALID, "output", "Missing mode argument."); 10 return cmd_results_new(CMD_INVALID, "Missing mode argument.");
11 } 11 }
12 12
13 struct output_config *output = config->handler_context.output_config; 13 struct output_config *output = config->handler_context.output_config;
@@ -17,20 +17,18 @@ struct cmd_results *output_cmd_mode(int argc, char **argv) {
17 if (*end) { 17 if (*end) {
18 // Format is 1234x4321 18 // Format is 1234x4321
19 if (*end != 'x') { 19 if (*end != 'x') {
20 return cmd_results_new(CMD_INVALID, "output", 20 return cmd_results_new(CMD_INVALID, "Invalid mode width.");
21 "Invalid mode width.");
22 } 21 }
23 ++end; 22 ++end;
24 output->height = strtol(end, &end, 10); 23 output->height = strtol(end, &end, 10);
25 if (*end) { 24 if (*end) {
26 if (*end != '@') { 25 if (*end != '@') {
27 return cmd_results_new(CMD_INVALID, "output", 26 return cmd_results_new(CMD_INVALID, "Invalid mode height.");
28 "Invalid mode height.");
29 } 27 }
30 ++end; 28 ++end;
31 output->refresh_rate = strtof(end, &end); 29 output->refresh_rate = strtof(end, &end);
32 if (strcasecmp("Hz", end) != 0) { 30 if (strcasecmp("Hz", end) != 0) {
33 return cmd_results_new(CMD_INVALID, "output", 31 return cmd_results_new(CMD_INVALID,
34 "Invalid mode refresh rate."); 32 "Invalid mode refresh rate.");
35 } 33 }
36 } 34 }
@@ -38,13 +36,12 @@ struct cmd_results *output_cmd_mode(int argc, char **argv) {
38 // Format is 1234 4321 36 // Format is 1234 4321
39 argc--; argv++; 37 argc--; argv++;
40 if (!argc) { 38 if (!argc) {
41 return cmd_results_new(CMD_INVALID, "output", 39 return cmd_results_new(CMD_INVALID,
42 "Missing mode argument (height)."); 40 "Missing mode argument (height).");
43 } 41 }
44 output->height = strtol(*argv, &end, 10); 42 output->height = strtol(*argv, &end, 10);
45 if (*end) { 43 if (*end) {
46 return cmd_results_new(CMD_INVALID, "output", 44 return cmd_results_new(CMD_INVALID, "Invalid mode height.");
47 "Invalid mode height.");
48 } 45 }
49 } 46 }
50 47