aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-28 16:43:05 +0100
committerSimon Ser <contact@emersion.fr>2023-04-14 18:34:54 +0200
commit08c1946d71039e583696842c3558b337aede1cbf (patch)
tree3873db2edfb31146bd6cd17dae63f068aef34f05 /sway/commands
parentac8962eb626a8c715241ae91646f2d1bfcb61533 (diff)
Use format_str() throughout
Diffstat (limited to 'sway/commands')
-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])) {