diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-28 16:43:05 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-04-14 18:34:54 +0200 |
commit | 08c1946d71039e583696842c3558b337aede1cbf (patch) | |
tree | 3873db2edfb31146bd6cd17dae63f068aef34f05 /sway/commands.c | |
parent | common/gesture: use format_str() (diff) | |
download | sway-08c1946d71039e583696842c3558b337aede1cbf.tar.gz sway-08c1946d71039e583696842c3558b337aede1cbf.tar.zst sway-08c1946d71039e583696842c3558b337aede1cbf.zip |
Use format_str() throughout
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/sway/commands.c b/sway/commands.c index 0ea44129..55eda183 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -489,20 +489,10 @@ struct cmd_results *cmd_results_new(enum cmd_status status, | |||
489 | } | 489 | } |
490 | results->status = status; | 490 | results->status = status; |
491 | if (format) { | 491 | if (format) { |
492 | char *error = NULL; | ||
493 | va_list args; | 492 | va_list args; |
494 | va_start(args, format); | 493 | va_start(args, format); |
495 | int slen = vsnprintf(NULL, 0, format, args); | 494 | results->error = vformat_str(format, args); |
496 | va_end(args); | 495 | va_end(args); |
497 | if (slen > 0) { | ||
498 | error = malloc(slen + 1); | ||
499 | if (error != NULL) { | ||
500 | va_start(args, format); | ||
501 | vsnprintf(error, slen + 1, format, args); | ||
502 | va_end(args); | ||
503 | } | ||
504 | } | ||
505 | results->error = error; | ||
506 | } else { | 496 | } else { |
507 | results->error = NULL; | 497 | results->error = NULL; |
508 | } | 498 | } |