aboutsummaryrefslogtreecommitdiff
path: root/src/Package.zig
diff options
context:
space:
mode:
authorLee Cannon <leecannon@leecannon.xyz>2021-10-29 00:37:25 +0100
committerLee Cannon <leecannon@leecannon.xyz>2021-11-30 23:32:47 +0000
commit85de022c5671d777f62ddff254a814dab05242fc (patch)
tree037f58c4b07d18b80cf48cf74d0f0e8c8866f8f2 /src/Package.zig
parent1e0addcf73ee71d23a41b744995848bcca38e8d3 (diff)
downloadzig-85de022c5671d777f62ddff254a814dab05242fc.tar.gz
zig-85de022c5671d777f62ddff254a814dab05242fc.zip
allocgate: std Allocator interface refactor
Diffstat (limited to 'src/Package.zig')
-rw-r--r--src/Package.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Package.zig b/src/Package.zig
index 976e92d096..df894280a9 100644
--- a/src/Package.zig
+++ b/src/Package.zig
@@ -21,7 +21,7 @@ root_src_directory_owned: bool = false,
/// Allocate a Package. No references to the slices passed are kept.
pub fn create(
- gpa: *Allocator,
+ gpa: Allocator,
/// Null indicates the current working directory
root_src_dir_path: ?[]const u8,
/// Relative to root_src_dir_path
@@ -49,7 +49,7 @@ pub fn create(
}
pub fn createWithDir(
- gpa: *Allocator,
+ gpa: Allocator,
directory: Compilation.Directory,
/// Relative to `directory`. If null, means `directory` is the root src dir
/// and is owned externally.
@@ -87,7 +87,7 @@ pub fn createWithDir(
/// Free all memory associated with this package. It does not destroy any packages
/// inside its table; the caller is responsible for calling destroy() on them.
-pub fn destroy(pkg: *Package, gpa: *Allocator) void {
+pub fn destroy(pkg: *Package, gpa: Allocator) void {
gpa.free(pkg.root_src_path);
if (pkg.root_src_directory_owned) {
@@ -104,7 +104,7 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void {
}
/// Only frees memory associated with the table.
-pub fn deinitTable(pkg: *Package, gpa: *Allocator) void {
+pub fn deinitTable(pkg: *Package, gpa: Allocator) void {
var it = pkg.table.keyIterator();
while (it.next()) |key| {
gpa.free(key.*);
@@ -113,13 +113,13 @@ pub fn deinitTable(pkg: *Package, gpa: *Allocator) void {
pkg.table.deinit(gpa);
}
-pub fn add(pkg: *Package, gpa: *Allocator, name: []const u8, package: *Package) !void {
+pub fn add(pkg: *Package, gpa: Allocator, name: []const u8, package: *Package) !void {
try pkg.table.ensureUnusedCapacity(gpa, 1);
const name_dupe = try gpa.dupe(u8, name);
pkg.table.putAssumeCapacityNoClobber(name_dupe, package);
}
-pub fn addAndAdopt(parent: *Package, gpa: *Allocator, name: []const u8, child: *Package) !void {
+pub fn addAndAdopt(parent: *Package, gpa: Allocator, name: []const u8, child: *Package) !void {
assert(child.parent == null); // make up your mind, who is the parent??
child.parent = parent;
return parent.add(gpa, name, child);