# std.c.setlocale: fix return type to nullable pointer · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/ece8480fc2190229721bf1690116fa6d767f4c0e)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: ece8480fc2190229721bf1690116fa6d767f4c0e

Requested commit: ece8480fc2190229721bf1690116fa6d767f4c0e

Commit: ece8480fc2190229721bf1690116fa6d767f4c0e

Tree: b04fcc80ff69707eb191db638d53dcccd99051e5

Author: Eric Joldasov

Committer: Eric Joldasov

## Message

````
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>

````

## Parents

- [888708ec8af9b60681ef14fb0a5c265f2a30b41f](https://git.cafe/gitcafe/zig/commit/888708ec8af9b60681ef14fb0a5c265f2a30b41f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/ece8480fc2190229721bf1690116fa6d767f4c0e?format=markdown)
