aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bar/id.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/bar/id.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/bar/id.c')
-rw-r--r--sway/commands/bar/id.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c
index 35509459..bef3023b 100644
--- a/sway/commands/bar/id.c
+++ b/sway/commands/bar/id.c
@@ -12,15 +12,15 @@ struct cmd_results *bar_cmd_id(int argc, char **argv) {
12 const char *name = argv[0]; 12 const char *name = argv[0];
13 const char *oldname = config->current_bar->id; 13 const char *oldname = config->current_bar->id;
14 if (strcmp(name, oldname) == 0) { 14 if (strcmp(name, oldname) == 0) {
15 return cmd_results_new(CMD_SUCCESS, NULL, NULL); // NOP 15 return cmd_results_new(CMD_SUCCESS, NULL); // NOP
16 } else if (strcmp(name, "id") == 0) { 16 } else if (strcmp(name, "id") == 0) {
17 return cmd_results_new(CMD_INVALID, "id", "id cannot be 'id'"); 17 return cmd_results_new(CMD_INVALID, "id cannot be 'id'");
18 } 18 }
19 // check if id is used by a previously defined bar 19 // check if id is used by a previously defined bar
20 for (int i = 0; i < config->bars->length; ++i) { 20 for (int i = 0; i < config->bars->length; ++i) {
21 struct bar_config *find = config->bars->items[i]; 21 struct bar_config *find = config->bars->items[i];
22 if (strcmp(name, find->id) == 0 && config->current_bar != find) { 22 if (strcmp(name, find->id) == 0 && config->current_bar != find) {
23 return cmd_results_new(CMD_FAILURE, "id", 23 return cmd_results_new(CMD_FAILURE,
24 "Id '%s' already defined for another bar. Id unchanged (%s).", 24 "Id '%s' already defined for another bar. Id unchanged (%s).",
25 name, oldname); 25 name, oldname);
26 } 26 }
@@ -31,5 +31,5 @@ struct cmd_results *bar_cmd_id(int argc, char **argv) {
31 // free old bar id 31 // free old bar id
32 free(config->current_bar->id); 32 free(config->current_bar->id);
33 config->current_bar->id = strdup(name); 33 config->current_bar->id = strdup(name);
34 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 34 return cmd_results_new(CMD_SUCCESS, NULL);
35} 35}