diff options
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/bar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sway/commands/bar.c b/sway/commands/bar.c index 548106b3..ff111163 100644 --- a/sway/commands/bar.c +++ b/sway/commands/bar.c | |||
@@ -36,15 +36,15 @@ struct cmd_results *cmd_bar(int argc, char **argv) { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | // set bar id | 38 | // set bar id |
39 | int i; | 39 | for (int i = 0; i < config->bars->length; ++i) { |
40 | for (i = 0; i < config->bars->length; ++i) { | ||
41 | if (bar == config->bars->items[i]) { | 40 | if (bar == config->bars->items[i]) { |
42 | const int len = 5 + numlen(i); // "bar-" + i + \0 | 41 | const int len = 5 + numlen(i); // "bar-" + i + \0 |
43 | bar->id = malloc(len * sizeof(char)); | 42 | bar->id = malloc(len * sizeof(char)); |
44 | if (bar->id) { | 43 | if (bar->id) { |
45 | snprintf(bar->id, len, "bar-%d", i); | 44 | snprintf(bar->id, len, "bar-%d", i); |
46 | } else { | 45 | } else { |
47 | return cmd_results_new(CMD_FAILURE, "bar", "Unable to allocate bar ID"); | 46 | return cmd_results_new(CMD_FAILURE, |
47 | "bar", "Unable to allocate bar ID"); | ||
48 | } | 48 | } |
49 | break; | 49 | break; |
50 | } | 50 | } |