mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std/fmt: rename allocPrint0() to allocPrintZ()
This is consistent with other standard library functions working with null terminated pointers/slices.
This commit is contained in:
parent
3b4432d9a6
commit
b259696cfb
1 changed files with 4 additions and 1 deletions
|
|
@ -1151,7 +1151,10 @@ pub fn allocPrint(allocator: *mem.Allocator, comptime fmt: []const u8, args: any
|
|||
};
|
||||
}
|
||||
|
||||
pub fn allocPrint0(allocator: *mem.Allocator, comptime fmt: []const u8, args: anytype) AllocPrintError![:0]u8 {
|
||||
/// Deprecated, use allocPrintZ
|
||||
pub const allocPrint0 = allocPrintZ;
|
||||
|
||||
pub fn allocPrintZ(allocator: *mem.Allocator, comptime fmt: []const u8, args: anytype) AllocPrintError![:0]u8 {
|
||||
const result = try allocPrint(allocator, fmt ++ "\x00", args);
|
||||
return result[0 .. result.len - 1 :0];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue