diff options
author | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-02-25 13:49:12 +1100 |
---|---|---|
committer | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-02-25 13:49:12 +1100 |
commit | 938f745f052c14fccaa987b98ea4ac84e70c1fcc (patch) | |
tree | fe49ddad815c65ef0deb87dd76e172051e6c49e7 /src | |
parent | da13dc8b030b9c0ed4805dca9dab3c280583a91f (diff) |
chore: format
Diffstat (limited to 'src')
-rw-r--r-- | src/platform/file.h | 4 | ||||
-rw-r--r-- | src/std/str.h | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/platform/file.h b/src/platform/file.h index fa09891..8bb22c8 100644 --- a/src/platform/file.h +++ b/src/platform/file.h @@ -10,8 +10,8 @@ #include "str.h" typedef struct str8_opt { - str8 contents; - bool has_value; + str8 contents; + bool has_value; } str8_opt; const char* string_from_file(const char* path); diff --git a/src/std/str.h b/src/std/str.h index d2fa891..f6f8820 100644 --- a/src/std/str.h +++ b/src/std/str.h @@ -1,12 +1,12 @@ /** * @file str.h * @author your name (you@domain.com) - * @brief + * @brief * @version 0.1 * @date 2024-02-25 - * + * * @copyright Copyright (c) 2024 - * + * */ #pragma once @@ -19,22 +19,22 @@ print routines are written. alternatively wrap in `cstr()` and pass to `%s`. */ typedef struct { - u8 *buf; + u8* buf; size_t len; } str8; - // --- Constructors /** @brief Take a string literal and turn it into a `str8` */ -#define str8lit(s) (str8){(u8 *)s, ((sizeof(s) / sizeof(*(s)) - 1))} +#define str8lit(s) \ + (str8) { (u8*)s, ((sizeof(s) / sizeof(*(s)) - 1)) } str8 str8_create(u8* buf, size_t len); /** @brief Return a null-terminated C string cloned onto an arena */ char* str8_to_cstr(arena* a, str8 s); -#define cstr(a, s) (str8_to_cstr(a, s)) // Shorthand +#define cstr(a, s) (str8_to_cstr(a, s)) // Shorthand // --- Comparisons @@ -43,8 +43,8 @@ bool str8_equals(str8 a, str8 b); /** * @brief Compare the first `first_nchars` of each string for equality - * @details If either of the strings are shorter than the number only the characters up until the end - of the shorter string will be compared. + * @details If either of the strings are shorter than the number only the characters up until the + end of the shorter string will be compared. * @returns 0 if they are fully equal up until `first_nchars`, i.e they never differed, else it returns the index at which the first string differed from the second string. */ @@ -69,5 +69,5 @@ str8 str8_concat(arena* a, str8 left, str8 right); /// --- Misc static inline bool str8_is_null_term(str8 a) { - return a.buf[a.len] == 0; // This doesn't seem safe. YOLO + return a.buf[a.len] == 0; // This doesn't seem safe. YOLO }
\ No newline at end of file |