diff options
Diffstat (limited to 'sway/commands/bar.c')
-rw-r--r-- | sway/commands/bar.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sway/commands/bar.c b/sway/commands/bar.c index 8571d282..22756acb 100644 --- a/sway/commands/bar.c +++ b/sway/commands/bar.c | |||
@@ -73,12 +73,10 @@ struct cmd_results *cmd_bar(int argc, char **argv) { | |||
73 | } | 73 | } |
74 | ++argv; --argc; | 74 | ++argv; --argc; |
75 | } else if (config->reading && !config->current_bar) { | 75 | } else if (config->reading && !config->current_bar) { |
76 | int len = snprintf(NULL, 0, "bar-%d", config->bars->length) + 1; | 76 | id = format_str("bar-%d", config->bars->length); |
77 | id = malloc(len * sizeof(char)); | ||
78 | if (!id) { | 77 | if (!id) { |
79 | return cmd_results_new(CMD_FAILURE, "Unable to allocate bar id"); | 78 | return cmd_results_new(CMD_FAILURE, "Unable to allocate bar id"); |
80 | } | 79 | } |
81 | snprintf(id, len, "bar-%d", config->bars->length); | ||
82 | } else if (!config->reading && strcmp(argv[0], "mode") != 0 && | 80 | } else if (!config->reading && strcmp(argv[0], "mode") != 0 && |
83 | strcmp(argv[0], "hidden_state") != 0) { | 81 | strcmp(argv[0], "hidden_state") != 0) { |
84 | if (is_subcommand(argv[0])) { | 82 | if (is_subcommand(argv[0])) { |