authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-29 19:41:16-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2019-05-29 19:41:16-04:00
log345501a72d9780e66beecd549cf6e56c9cde1a95
tree7f47cd4f56c5dc245bb1901c12ce7c6c6a7ce2bd
parentc66a747045e660a7e8b8146f9ee28c89f3960940
parentf2b64fd18f73fe26934b388c1da95e1b4e770c83
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #2567 from emekoi/fix-dynlib

remove allocator from DynLib

1 files changed, 3 insertions(+), 5 deletions(-)

std/dynamic_library.zig+3-5
......@@ -104,7 +104,7 @@ pub const LinuxDynLib = struct {
104104 memory: []align(mem.page_size) u8,
105105
106106 /// Trusts the file
107 pub fn open(allocator: *mem.Allocator, path: []const u8) !DynLib {
107 pub fn open(path: []const u8) !DynLib {
108108 const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC);
109109 errdefer os.close(fd);
110110
......@@ -244,14 +244,12 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [
244244}
245245
246246pub const WindowsDynLib = struct {
247 allocator: *mem.Allocator,
248247 dll: windows.HMODULE,
249248
250 pub fn open(allocator: *mem.Allocator, path: []const u8) !WindowsDynLib {
249 pub fn open(path: []const u8) !WindowsDynLib {
251250 const wpath = try windows.sliceToPrefixedFileW(path);
252251
253252 return WindowsDynLib{
254 .allocator = allocator,
255253 .dll = try windows.LoadLibraryW(&wpath),
256254 };
257255 }
......@@ -273,7 +271,7 @@ test "dynamic_library" {
273271 else => return,
274272 };
275273
276 const dynlib = DynLib.open(std.debug.global_allocator, libname) catch |err| {
274 const dynlib = DynLib.open(libname) catch |err| {
277275 testing.expect(err == error.FileNotFound);
278276 return;
279277 };