]> git.sur5r.net Git - i3/i3status/commitdiff
No longer use a temporary buffer in the die() function
authorOlivier Gayot <olivier.gayot@sigexec.com>
Mon, 11 Jun 2018 22:52:29 +0000 (00:52 +0200)
committerOlivier Gayot <olivier.gayot@sigexec.com>
Wed, 20 Jun 2018 09:01:59 +0000 (11:01 +0200)
Before the following change

  f947d0a Breaks configfiles! Major refactoring of i3status, see below

The die(fmt, ...) function was outputting the reason to the status bar
in addition to stderr. For this reason, it was meaningful to create a
temporary string according to the format string and then passing it
around to the different functions.

Nowadays, we only display the error message to stderr so calling
fprintf(stderr, ...) is much simpler.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
src/general.c

index f299a2b807ea8e0772a88bf016c8c06c15eaaf70..2424cc60ea24fd4089d8d434f6c3fd48a1c44303 100644 (file)
@@ -51,12 +51,10 @@ char *skip_character(char *input, char character, int amount) {
  *
  */
 void die(const char *fmt, ...) {
  *
  */
 void die(const char *fmt, ...) {
-    char buffer[512];
     va_list ap;
     va_start(ap, fmt);
     va_list ap;
     va_start(ap, fmt);
-    (void)vsnprintf(buffer, sizeof(buffer), fmt, ap);
+    (void)vfprintf(stderr, fmt, ap);
     va_end(ap);
 
     va_end(ap);
 
-    fprintf(stderr, "%s", buffer);
     exit(EXIT_FAILURE);
 }
     exit(EXIT_FAILURE);
 }