mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
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>
This commit is contained in:
parent
888708ec8a
commit
ece8480fc2
1 changed files with 1 additions and 1 deletions
|
|
@ -1914,7 +1914,7 @@ pub const LC = enum(c_int) {
|
|||
IDENTIFICATION = 12,
|
||||
};
|
||||
|
||||
pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) [*:0]const u8;
|
||||
pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8;
|
||||
|
||||
pub const getcontext = if (builtin.target.isAndroid())
|
||||
@compileError("android bionic libc does not implement getcontext")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue