about summary refs log tree commit diff
path: root/boot/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/common.c')
-rw-r--r--boot/common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/boot/common.c b/boot/common.c
index 388aea5..d814538 100644
--- a/boot/common.c
+++ b/boot/common.c
@@ -62,6 +62,10 @@ check(bool condition, const ascii* message)
     if (!condition) failure(message);
 }
 
+// for each entry in a linked list.
+#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
 
@@ -156,6 +160,12 @@ string_length(struct String s)
     return s.length;
 }
 
+void
+string_print(struct String s)
+{
+    printf("%.*s", (int32)s.length, s.data);
+}
+
 // single iteration of the CRC32 checksum algorithm
 // described in POSIX.
 // see: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cksum.html