mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
compiler-rt: move strlen from libzigc to here
LLVM 21 has started recognizing strlen-like idioms and optimizing them to strlen calls, so we need this function provided in compiler-rt for libc-less compilations.
This commit is contained in:
@@ -4,7 +4,6 @@ const common = @import("common.zig");
|
||||
|
||||
comptime {
|
||||
@export(&strcmp, .{ .name = "strcmp", .linkage = common.linkage, .visibility = common.visibility });
|
||||
@export(&strlen, .{ .name = "strlen", .linkage = common.linkage, .visibility = common.visibility });
|
||||
@export(&strncmp, .{ .name = "strncmp", .linkage = common.linkage, .visibility = common.visibility });
|
||||
@export(&strcasecmp, .{ .name = "strcasecmp", .linkage = common.linkage, .visibility = common.visibility });
|
||||
@export(&strncasecmp, .{ .name = "strncasecmp", .linkage = common.linkage, .visibility = common.visibility });
|
||||
@@ -103,7 +102,3 @@ test strncmp {
|
||||
try std.testing.expect(strncmp(@ptrCast("b"), @ptrCast("a"), 1) > 0);
|
||||
try std.testing.expect(strncmp(@ptrCast("\xff"), @ptrCast("\x02"), 1) > 0);
|
||||
}
|
||||
|
||||
fn strlen(s: [*:0]const c_char) callconv(.c) usize {
|
||||
return std.mem.len(s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user