diff options
| author | Bobby <[email protected]> | 2026-02-24 06:56:58 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-02-24 06:56:58 +0530 |
| commit | 5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8 (patch) | |
| tree | 2ae2a13678844b82b43583ca28eed4d4b6223ec0 /system.old/libraries/string/cstring.zig | |
| parent | 297c66b480a238dad5ce7f03405fe6f5b9123701 (diff) | |
| download | akiba-5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8.tar.xz akiba-5fe89e6f5b6fd6f5b5589b9e5d4714e0f4fbe5e8.zip | |
Bunch of stuff moved as .old for new arch change
Diffstat (limited to 'system.old/libraries/string/cstring.zig')
| -rw-r--r-- | system.old/libraries/string/cstring.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/system.old/libraries/string/cstring.zig b/system.old/libraries/string/cstring.zig new file mode 100644 index 0000000..32ad60f --- /dev/null +++ b/system.old/libraries/string/cstring.zig @@ -0,0 +1,17 @@ +//! C-string utilities + +pub fn len(str: [*:0]const u8) usize { + var i: usize = 0; + while (str[i] != 0) : (i += 1) {} + return i; +} + +pub fn toSlice(str: [*:0]const u8) []const u8 { + return str[0..len(str)]; +} + +pub fn findNull(buf: []const u8) usize { + var i: usize = 0; + while (i < buf.len and buf[i] != 0) : (i += 1) {} + return i; +} |
