about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-03-14 16:43:08 +0100
committerMel <mel@rnrd.eu>2025-03-14 16:43:08 +0100
commit742cc47bfbe67806f80bf4e821476b5efff9a9f6 (patch)
tree3a68c4d4bf7de4b1648ad11444dfc8b00dcc1c04
parentda65d5ff18ff2fb598ac4cf25063b233b000d7b5 (diff)
downloadcatskill-742cc47bfbe67806f80bf4e821476b5efff9a9f6.tar.zst
catskill-742cc47bfbe67806f80bf4e821476b5efff9a9f6.zip
Add compound literal casts to common functions (this isn't C++)
Signed-off-by: Mel <mel@rnrd.eu>
-rw-r--r--boot/catboot.c4
-rw-r--r--boot/common.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/boot/catboot.c b/boot/catboot.c
index b36bb97..56aaeb6 100644
--- a/boot/catboot.c
+++ b/boot/catboot.c
@@ -39,8 +39,8 @@ read_file(const ascii* path)
     return file_data;
 }
 
-integer
-main(const integer argc, const ascii* argv[])
+int32
+main(const int32 argc, const ascii* argv[])
 {
     if (argc != 2) {
         printf("usage: catboot <filename>\n");
diff --git a/boot/common.c b/boot/common.c
index 67e13eb..d43bbc1 100644
--- a/boot/common.c
+++ b/boot/common.c
@@ -100,12 +100,21 @@ string_new(const ascii* data, uint length)
     for (uint i = 0; i < length; ++i) at[i] = data[i];
     at[length] = '\0';
 
-    return {
+    return (struct String){
         .data = at,
         .length = length,
     };
 }
 
+struct String
+string_empty()
+{
+    return (struct String){
+        .data = nil,
+        .length = 0,
+    };
+}
+
 // allocates a new string in the global string region,
 // taking the data from a null-terminated C string.
 struct String
@@ -124,7 +133,7 @@ struct String
 string_from_static_c_string(const char* c_string)
 {
     uint length = strlen(c_string);
-    return {
+    return (struct String){
         .data = (ascii*)c_string,
         .length = length,
     };