From 1e2b456f08a5d00c8cbe290fb7974818e8f17b46 Mon Sep 17 00:00:00 2001 From: Mel Date: Mon, 30 Jun 2025 02:53:10 +0200 Subject: Re-format FOR_EACH macros as control structures Signed-off-by: Mel --- boot/common.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'boot/common.c') diff --git a/boot/common.c b/boot/common.c index 8291a51..318edf7 100644 --- a/boot/common.c +++ b/boot/common.c @@ -75,10 +75,10 @@ failure(const ascii* message) { fflush(stdout); // flush stdout to ensure any message is printed before the error. - const ascii* format = - ANSI_RED ANSI_BOLD ";( sorry, a failure has occurred..." ANSI_NO_BOLD "\n" - "-> %s!" "\n" - ANSI_RESET; + const ascii* format = ANSI_RED ANSI_BOLD + ";( sorry, a failure has occurred..." ANSI_NO_BOLD "\n" + "-> %s!" + "\n" ANSI_RESET; fprintf(stderr, format, message); exit(EXIT_FAILURE); @@ -92,8 +92,7 @@ check(bool condition, const ascii* message) } // for each entry in a linked list. -#define FOR_EACH(type, cursor, head) \ - for (type cursor = head; cursor != nil; cursor = cursor->next) +#define FOR_EACH(type, cursor, head) for (type cursor = head; cursor != nil; cursor = cursor->next) // the common size of region memory blocks. #define REGION_SIZE 65536 @@ -239,7 +238,7 @@ string_array_at(const struct String_Array* array, uint index) } #define STRING_ARRAY_FOR_EACH(cursor, str, array) \ - struct String str = array.strings[0]; \ + struct String str = array.strings[0]; \ for (uint cursor = 0; cursor < array.count; str = array.strings[++cursor]) // single iteration of the CRC32 checksum algorithm -- cgit 1.4.1