summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-03-06 07:19:57 +1100
committerOmniscient <omniscient.oce@gmail.com>2024-03-06 07:19:57 +1100
commitcb4a2f1bda4d4a8220bf01dcf557d68543ebf40b (patch)
tree0e32e32c27b6e74d2a33db0e6fab926febc2ed68
parent7c71005794ee7904ad113d5fff2c7a9aca3cda53 (diff)
chore: fmt
-rw-r--r--src/std/str.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/std/str.c b/src/std/str.c
index 7dafef1..1c687fa 100644
--- a/src/std/str.c
+++ b/src/std/str.c
@@ -1,6 +1,6 @@
#include "str.h"
-#include <string.h>
#include <assert.h>
+#include <string.h>
#include "mem.h"
str8 str8_create(u8* buf, size_t len) { return (str8){ .buf = buf, .len = len }; }
@@ -48,25 +48,15 @@ str8 str8_substr(str8 s, u64 min, u64 max) {
assert(min < s.len);
assert(max >= 0);
assert(max <= s.len);
- uint8_t * start = s.buf + (ptrdiff_t)min;
+ uint8_t* start = s.buf + (ptrdiff_t)min;
size_t new_len = max - min;
- return (str8) {.buf = start, .len = new_len };
-}
-
-str8 str8_take(str8 s, u64 first_n) {
- return str8_substr(s, 0, first_n);
+ return (str8){ .buf = start, .len = new_len };
}
-str8 str8_drop(str8 s, u64 last_n) {
- return str8_substr(s, s.len - last_n, s.len);
-}
-
-str8 str8_skip(str8 s, u64 n) {
- return str8_substr(s, n, s.len);
-}
+str8 str8_take(str8 s, u64 first_n) { return str8_substr(s, 0, first_n); }
-str8 str8_chop(str8 s, u64 n) {
- return str8_substr(s, 0, s.len - n);
-}
+str8 str8_drop(str8 s, u64 last_n) { return str8_substr(s, s.len - last_n, s.len); }
+str8 str8_skip(str8 s, u64 n) { return str8_substr(s, n, s.len); }
+str8 str8_chop(str8 s, u64 n) { return str8_substr(s, 0, s.len - n); }