From f33c70176cd078c6e1c189b9c2a61089422129c9 Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Mon, 8 Sep 2025 19:09:10 +0200 Subject: Enforce code style, reformat project Signed-off-by: Filip Wandzio --- src/util/util.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src/util/util.c') diff --git a/src/util/util.c b/src/util/util.c index 7419d0c..61c864c 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -18,19 +18,21 @@ * Usage: * die("Error occurred in function %s", __func__); */ -void die(const char *format_string, ...) { - va_list argument_list; - va_start(argument_list, format_string); - vfprintf(stderr, format_string, argument_list); - va_end(argument_list); - - if (format_string[0] && format_string[strlen(format_string) - 1] == ':') { - fputc(' ', stderr); - perror(NULL); - } else - fputc('\n', stderr); - - exit(1); +void die(const char *format_string, ...) +{ + va_list argument_list; + va_start(argument_list, format_string); + vfprintf(stderr, format_string, argument_list); + va_end(argument_list); + + if (format_string[0] && + format_string[strlen(format_string) - 1] == ':') { + fputc(' ', stderr); + perror(NULL); + } else + fputc('\n', stderr); + + exit(1); } /* @@ -52,11 +54,12 @@ void die(const char *format_string, ...) { * int *array = ecalloc(10, sizeof(int)); // Allocate memory for an array of * 10 integers. */ -void *ecalloc(size_t num_elements, size_t element_size) { - void *allocated_memory; +void *ecalloc(size_t num_elements, size_t element_size) +{ + void *allocated_memory; - if (!(allocated_memory = calloc(num_elements, element_size))) - die("calloc:"); + if (!(allocated_memory = calloc(num_elements, element_size))) + die("calloc:"); - return allocated_memory; + return allocated_memory; } -- cgit v1.2.3