summaryrefslogtreecommitdiff
path: root/sway/commands/bar.c
diff options
context:
space:
mode:
authorReza Jelveh <[email protected]>2024-04-15 13:39:41 +0800
committerGitHub <[email protected]>2024-04-15 01:39:41 -0400
commitfb86ed6b0588dfdebfb66ce875bc63cfa0a897f6 (patch)
tree29857a1769107adc58696f08d379f608aa4e29a2 /sway/commands/bar.c
parenta5e79676c4bd22fc5902182acf0667907202a465 (diff)
feat: 1.9 merge (#277)
Co-authored-by: William McKinnon <[email protected]> Co-authored-by: Erik Reider <[email protected]>
Diffstat (limited to 'sway/commands/bar.c')
-rw-r--r--sway/commands/bar.c4
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) {
}
++argv; --argc;
} else if (config->reading && !config->current_bar) {
- int len = snprintf(NULL, 0, "bar-%d", config->bars->length) + 1;
- id = malloc(len * sizeof(char));
+ id = format_str("bar-%d", config->bars->length);
if (!id) {
return cmd_results_new(CMD_FAILURE, "Unable to allocate bar id");
}
- snprintf(id, len, "bar-%d", config->bars->length);
} else if (!config->reading && strcmp(argv[0], "mode") != 0 &&
strcmp(argv[0], "hidden_state") != 0) {
if (is_subcommand(argv[0])) {