aboutsummaryrefslogtreecommitdiff
path: root/std/cstr.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-08-21 16:07:28 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-08-21 16:07:28 -0400
commit51852d2587b931767a12d42ce39d5c191eea10ea (patch)
treefd875c1aa365a8264510eb4c43f874c438a6036d /std/cstr.zig
parentbda5539e9d8b5f15b8165393e4118c8601188276 (diff)
downloadzig-51852d2587b931767a12d42ce39d5c191eea10ea.tar.gz
zig-51852d2587b931767a12d42ce39d5c191eea10ea.zip
fix windows
Diffstat (limited to 'std/cstr.zig')
-rw-r--r--std/cstr.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/std/cstr.zig b/std/cstr.zig
index e83d5a39e9..a8aaf21279 100644
--- a/std/cstr.zig
+++ b/std/cstr.zig
@@ -9,10 +9,9 @@ pub const line_sep = switch (builtin.os) {
else => "\n",
};
+/// Deprecated, use mem.len
pub fn len(ptr: [*]const u8) usize {
- var count: usize = 0;
- while (ptr[count] != 0) : (count += 1) {}
- return count;
+ return mem.len(u8, ptr);
}
pub fn cmp(a: [*]const u8, b: [*]const u8) i8 {
@@ -27,12 +26,14 @@ pub fn cmp(a: [*]const u8, b: [*]const u8) i8 {
}
}
+/// Deprecated, use mem.toSliceConst
pub fn toSliceConst(str: [*]const u8) []const u8 {
- return str[0..len(str)];
+ return mem.toSliceConst(u8, str);
}
+/// Deprecated, use mem.toSlice
pub fn toSlice(str: [*]u8) []u8 {
- return str[0..len(str)];
+ return mem.toSlice(u8, str);
}
test "cstr fns" {