commit b259696cfba3c78b0641d30f159250465aa75af8 (tree)
parent 3b4432d9a6ae7f01f66e5ddcc15bf579d2c47460
Author: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 15 Oct 2020 12:19:50 +0200
std/fmt: rename allocPrint0() to allocPrintZ()
This is consistent with other standard library functions working with
null terminated pointers/slices.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
@@ -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];
}