authorgravatar for bratishkaerik@landless-city.netEric Joldasov <bratishkaerik@landless-city.net> 2024-07-16 00:27:56+05:00
committergravatar for bratishkaerik@landless-city.netEric Joldasov <bratishkaerik@landless-city.net> 2024-07-16 00:27:56+05:00
logece8480fc2190229721bf1690116fa6d767f4c0e
treeb04fcc80ff69707eb191db638d53dcccd99051e5
parent888708ec8af9b60681ef14fb0a5c265f2a30b41f
signaturelock-open Commit is signed but in an unrecognized format.

std.c.setlocale: fix return type to nullable pointer

According to https://en.cppreference.com/mwiki/index.php?title=c/locale/setlocale&oldid=171500 , `setlocale` "returns null value on failure": > Return value > pointer to a narrow null-terminated string identifying the C locale > after applying the changes, if any, or null pointer on failure. Example program: ```zig const std = @import("std"); pub fn main() void { const ptr = std.c.setlocale(.ALL, "non_existent"); std.debug.print("ptr = {d}\n", .{@intFromPtr(ptr)}); } ``` Output: ```console ptr = 0 ``` Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>

1 files changed, 1 insertions(+), 1 deletions(-)

lib/std/c.zig+1-1
......@@ -1914,7 +1914,7 @@ pub const LC = enum(c_int) {
19141914 IDENTIFICATION = 12,
19151915};
19161916
1917pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) [*:0]const u8;
1917pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8;
19181918
19191919pub const getcontext = if (builtin.target.isAndroid())
19201920 @compileError("android bionic libc does not implement getcontext")