Skip to content

Commit c085c6e

Browse files
Vexuandrewrk
authored andcommitted
std: remove meta.globalOption
1 parent 190ea02 commit c085c6e

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

lib/std/crypto/tlcsprng.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const os_has_fork = switch (builtin.os.tag) {
3535
};
3636
const os_has_arc4random = builtin.link_libc and @hasDecl(std.c, "arc4random_buf");
3737
const want_fork_safety = os_has_fork and !os_has_arc4random and
38-
(std.meta.globalOption("crypto_fork_safety", bool) orelse true);
38+
std.options.crypto_fork_safety;
3939
const maybe_have_wipe_on_fork = builtin.os.isAtLeast(.linux, .{
4040
.major = 4,
4141
.minor = 14,

lib/std/meta.zig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,13 +1099,6 @@ test "ArgsTuple forwarding" {
10991099
}
11001100
}
11011101

1102-
/// TODO: https://github.com/ziglang/zig/issues/425
1103-
pub fn globalOption(comptime name: []const u8, comptime T: type) ?T {
1104-
if (!@hasDecl(root, name))
1105-
return null;
1106-
return @as(T, @field(root, name));
1107-
}
1108-
11091102
/// Returns whether `error_union` contains an error.
11101103
pub fn isError(error_union: anytype) bool {
11111104
return if (error_union) |_| false else |_| true;

lib/std/std.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ pub const options = struct {
264264
else
265265
false;
266266

267+
pub const crypto_fork_safety: bool = if (@hasDecl(options_override, "crypto_fork_safety"))
268+
options_override.crypto_fork_safety
269+
else
270+
true;
271+
267272
/// By default Zig disables SIGPIPE by setting a "no-op" handler for it. Set this option
268273
/// to `true` to prevent that.
269274
///

0 commit comments

Comments
 (0)