paleofetch

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 64b001d16efb75738a2cf1d2c158ba0099c665ea
parent 9ae2287dc72c57a768e7a28507cda3c3a954387f
Author: sam-barr <samfbarr@outlook.com>
Date:   Fri, 24 Apr 2020 13:50:36 -0500

increased stability of halt_and_catch_fire macro

Diffstat:
Mpaleofetch.c | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/paleofetch.c b/paleofetch.c @@ -19,6 +19,14 @@ #define BUF_SIZE 150 #define REMOVE_CONST_STRING(A, B) remove_substring((A), (B), sizeof(B) - 1) +#define halt_and_catch_fire(fmt, ...) \ + do { \ + if(status != 0) { \ + fprintf(stderr, "paleofetch: " fmt "\n", ##__VA_ARGS__); \ + exit(status); \ + } \ + } while(0) + struct conf { char *label, *(*function)(); bool cached; @@ -30,12 +38,6 @@ struct sysinfo my_sysinfo; int title_length; int status; -#define halt_and_catch_fire(fmt, ...) \ - if(status != 0) { \ - fprintf(stderr, "paleofetch: " fmt "\n", ##__VA_ARGS__); \ - exit(status); \ - } - /* * Replaces the first newline character with null terminator */