diff options
author | M Stoeckl <code@mstoeckl.com> | 2019-01-10 18:27:21 -0500 |
---|---|---|
committer | M Stoeckl <code@mstoeckl.com> | 2019-01-14 08:05:29 -0500 |
commit | 2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 (patch) | |
tree | 56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/output/position.c | |
parent | Remove 'input' field of IPC command return json (diff) | |
download | sway-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/position.c')
-rw-r--r-- | sway/commands/output/position.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sway/commands/output/position.c b/sway/commands/output/position.c index 449767b1..689462cb 100644 --- a/sway/commands/output/position.c +++ b/sway/commands/output/position.c | |||
@@ -4,11 +4,10 @@ | |||
4 | 4 | ||
5 | struct cmd_results *output_cmd_position(int argc, char **argv) { | 5 | struct cmd_results *output_cmd_position(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", | 10 | return cmd_results_new(CMD_INVALID, "Missing position argument."); |
11 | "Missing position argument."); | ||
12 | } | 11 | } |
13 | 12 | ||
14 | char *end; | 13 | char *end; |
@@ -16,26 +15,22 @@ struct cmd_results *output_cmd_position(int argc, char **argv) { | |||
16 | if (*end) { | 15 | if (*end) { |
17 | // Format is 1234,4321 | 16 | // Format is 1234,4321 |
18 | if (*end != ',') { | 17 | if (*end != ',') { |
19 | return cmd_results_new(CMD_INVALID, "output", | 18 | return cmd_results_new(CMD_INVALID, "Invalid position x."); |
20 | "Invalid position x."); | ||
21 | } | 19 | } |
22 | ++end; | 20 | ++end; |
23 | config->handler_context.output_config->y = strtol(end, &end, 10); | 21 | config->handler_context.output_config->y = strtol(end, &end, 10); |
24 | if (*end) { | 22 | if (*end) { |
25 | return cmd_results_new(CMD_INVALID, "output", | 23 | return cmd_results_new(CMD_INVALID, "Invalid position y."); |
26 | "Invalid position y."); | ||
27 | } | 24 | } |
28 | } else { | 25 | } else { |
29 | // Format is 1234 4321 (legacy) | 26 | // Format is 1234 4321 (legacy) |
30 | argc--; argv++; | 27 | argc--; argv++; |
31 | if (!argc) { | 28 | if (!argc) { |
32 | return cmd_results_new(CMD_INVALID, "output", | 29 | return cmd_results_new(CMD_INVALID, "Missing position argument (y)."); |
33 | "Missing position argument (y)."); | ||
34 | } | 30 | } |
35 | config->handler_context.output_config->y = strtol(*argv, &end, 10); | 31 | config->handler_context.output_config->y = strtol(*argv, &end, 10); |
36 | if (*end) { | 32 | if (*end) { |
37 | return cmd_results_new(CMD_INVALID, "output", | 33 | return cmd_results_new(CMD_INVALID, "Invalid position y."); |
38 | "Invalid position y."); | ||
39 | } | 34 | } |
40 | } | 35 | } |
41 | 36 | ||