authorgravatar for tgschultz@gmail.comtgschultz <tgschultz@gmail.com> 2018-12-20 11:51:37-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-12-20 14:49:34-05:00
logf35ba34a884eb8253c2ddd584605191e1b977595
tree455a94a919608639c2535fec4fa56b612a567815
parent8cf3543c800e8a04afd99951616c70fd55651e39

Removed allocator from Linux version DynLib. Added dynamic_library.zig to std test list.


2 files changed, 3 insertions(+), 4 deletions(-)

std/dynamic_library.zig+1-3
...@@ -19,7 +19,6 @@ pub const DynLib = switch (builtin.os) {...@@ -19,7 +19,6 @@ pub const DynLib = switch (builtin.os) {
19};19};
2020
21pub const LinuxDynLib = struct {21pub const LinuxDynLib = struct {
22 allocator: *mem.Allocator,
23 elf_lib: ElfLib,22 elf_lib: ElfLib,
24 fd: i32,23 fd: i32,
25 map_addr: usize,24 map_addr: usize,
...@@ -27,7 +26,7 @@ pub const LinuxDynLib = struct {...@@ -27,7 +26,7 @@ pub const LinuxDynLib = struct {
2726
28 /// Trusts the file27 /// Trusts the file
29 pub fn open(allocator: *mem.Allocator, path: []const u8) !DynLib {28 pub fn open(allocator: *mem.Allocator, path: []const u8) !DynLib {
30 const fd = try std.os.posixOpen(allocator, path, 0, linux.O_RDONLY | linux.O_CLOEXEC);29 const fd = try std.os.posixOpen(path, 0, linux.O_RDONLY | linux.O_CLOEXEC);
31 errdefer std.os.close(fd);30 errdefer std.os.close(fd);
3231
33 const size = @intCast(usize, (try std.os.posixFStat(fd)).size);32 const size = @intCast(usize, (try std.os.posixFStat(fd)).size);
...@@ -45,7 +44,6 @@ pub const LinuxDynLib = struct {...@@ -45,7 +44,6 @@ pub const LinuxDynLib = struct {
45 const bytes = @intToPtr([*]align(std.os.page_size) u8, addr)[0..size];44 const bytes = @intToPtr([*]align(std.os.page_size) u8, addr)[0..size];
4645
47 return DynLib{46 return DynLib{
48 .allocator = allocator,
49 .elf_lib = try ElfLib.init(bytes),47 .elf_lib = try ElfLib.init(bytes),
50 .fd = fd,48 .fd = fd,
51 .map_addr = addr,49 .map_addr = addr,
std/index.zig+2-1
...@@ -57,7 +57,8 @@ test "std" {...@@ -57,7 +57,8 @@ test "std" {
57 _ = @import("mutex.zig");57 _ = @import("mutex.zig");
58 _ = @import("segmented_list.zig");58 _ = @import("segmented_list.zig");
59 _ = @import("spinlock.zig");59 _ = @import("spinlock.zig");
6060
61 _ = @import("dynamic_library.zig");
61 _ = @import("base64.zig");62 _ = @import("base64.zig");
62 _ = @import("build.zig");63 _ = @import("build.zig");
63 _ = @import("c/index.zig");64 _ = @import("c/index.zig");