aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-12-06 18:52:39 -0500
committerGitHub <noreply@github.com>2022-12-06 18:52:39 -0500
commite7d28344fa3ee81d6ad7ca5ce1f83d50d8502118 (patch)
tree012b2556f2bda10ae663fab8efb235efe30e02f4 /lib/std/process.zig
parent817cf6a82efa7ed274371a28621bbf88a723d9b7 (diff)
parent20d86d9c63476b6312b87dc5b0e4aa4822eb7717 (diff)
downloadzig-e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118.tar.gz
zig-e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118.zip
Merge pull request #13560 from ziglang/wasi-bootstrap
Nuke the C++ implementation of Zig from orbit using WASI
Diffstat (limited to 'lib/std/process.zig')
-rw-r--r--lib/std/process.zig20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/std/process.zig b/lib/std/process.zig
index 22f5cc382e..23fad9e8c6 100644
--- a/lib/std/process.zig
+++ b/lib/std/process.zig
@@ -355,7 +355,7 @@ pub const GetEnvVarOwnedError = error{
};
/// Caller must free returned memory.
-pub fn getEnvVarOwned(allocator: mem.Allocator, key: []const u8) GetEnvVarOwnedError![]u8 {
+pub fn getEnvVarOwned(allocator: Allocator, key: []const u8) GetEnvVarOwnedError![]u8 {
if (builtin.os.tag == .windows) {
const result_w = blk: {
const key_w = try std.unicode.utf8ToUtf16LeWithNull(allocator, key);
@@ -430,7 +430,7 @@ pub const ArgIteratorPosix = struct {
};
pub const ArgIteratorWasi = struct {
- allocator: mem.Allocator,
+ allocator: Allocator,
index: usize,
args: [][:0]u8,
@@ -438,7 +438,7 @@ pub const ArgIteratorWasi = struct {
/// You must call deinit to free the internal buffer of the
/// iterator after you are done.
- pub fn init(allocator: mem.Allocator) InitError!ArgIteratorWasi {
+ pub fn init(allocator: Allocator) InitError!ArgIteratorWasi {
const fetched_args = try ArgIteratorWasi.internalInit(allocator);
return ArgIteratorWasi{
.allocator = allocator,
@@ -447,7 +447,7 @@ pub const ArgIteratorWasi = struct {
};
}
- fn internalInit(allocator: mem.Allocator) InitError![][:0]u8 {
+ fn internalInit(allocator: Allocator) InitError![][:0]u8 {
const w = os.wasi;
var count: usize = undefined;
var buf_size: usize = undefined;
@@ -760,7 +760,7 @@ pub const ArgIterator = struct {
};
/// You must deinitialize iterator's internal buffers by calling `deinit` when done.
- pub fn initWithAllocator(allocator: mem.Allocator) InitError!ArgIterator {
+ pub fn initWithAllocator(allocator: Allocator) InitError!ArgIterator {
if (builtin.os.tag == .wasi and !builtin.link_libc) {
return ArgIterator{ .inner = try InnerType.init(allocator) };
}
@@ -804,7 +804,7 @@ pub fn args() ArgIterator {
}
/// You must deinitialize iterator's internal buffers by calling `deinit` when done.
-pub fn argsWithAllocator(allocator: mem.Allocator) ArgIterator.InitError!ArgIterator {
+pub fn argsWithAllocator(allocator: Allocator) ArgIterator.InitError!ArgIterator {
return ArgIterator.initWithAllocator(allocator);
}
@@ -827,7 +827,7 @@ test "args iterator" {
}
/// Caller must call argsFree on result.
-pub fn argsAlloc(allocator: mem.Allocator) ![][:0]u8 {
+pub fn argsAlloc(allocator: Allocator) ![][:0]u8 {
// TODO refactor to only make 1 allocation.
var it = try argsWithAllocator(allocator);
defer it.deinit();
@@ -864,7 +864,7 @@ pub fn argsAlloc(allocator: mem.Allocator) ![][:0]u8 {
return result_slice_list;
}
-pub fn argsFree(allocator: mem.Allocator, args_alloc: []const [:0]u8) void {
+pub fn argsFree(allocator: Allocator, args_alloc: []const [:0]u8) void {
var total_bytes: usize = 0;
for (args_alloc) |arg| {
total_bytes += @sizeOf([]u8) + arg.len + 1;
@@ -1089,7 +1089,7 @@ pub const ExecvError = std.os.ExecveError || error{OutOfMemory};
/// This function also uses the PATH environment variable to get the full path to the executable.
/// Due to the heap-allocation, it is illegal to call this function in a fork() child.
/// For that use case, use the `std.os` functions directly.
-pub fn execv(allocator: mem.Allocator, argv: []const []const u8) ExecvError {
+pub fn execv(allocator: Allocator, argv: []const []const u8) ExecvError {
return execve(allocator, argv, null);
}
@@ -1102,7 +1102,7 @@ pub fn execv(allocator: mem.Allocator, argv: []const []const u8) ExecvError {
/// Due to the heap-allocation, it is illegal to call this function in a fork() child.
/// For that use case, use the `std.os` functions directly.
pub fn execve(
- allocator: mem.Allocator,
+ allocator: Allocator,
argv: []const []const u8,
env_map: ?*const EnvMap,
) ExecvError {