diff options
| author | Jimmi Holst Christensen <jimmiholstchristensen@gmail.com> | 2018-10-15 09:51:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-15 09:51:15 -0400 |
| commit | 378d3e44034e817093966ea42c2940d6a0482dd8 (patch) | |
| tree | fe5f454097e1627b1afc65aebfb815dd70a7576d /std/dynamic_library.zig | |
| parent | 822d4fa216ea8f598e4a9d53161800494f449a94 (diff) | |
| download | zig-378d3e44034e817093966ea42c2940d6a0482dd8.tar.gz zig-378d3e44034e817093966ea42c2940d6a0482dd8.zip | |
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
Diffstat (limited to 'std/dynamic_library.zig')
| -rw-r--r-- | std/dynamic_library.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/std/dynamic_library.zig b/std/dynamic_library.zig index c0922003ce..7ddb94f84f 100644 --- a/std/dynamic_library.zig +++ b/std/dynamic_library.zig @@ -17,7 +17,7 @@ pub const DynLib = switch (builtin.os) { else => void, }; -pub const LinuxDynLib = struct { +pub const LinuxDynLib = struct.{ allocator: *mem.Allocator, elf_lib: ElfLib, fd: i32, @@ -43,7 +43,7 @@ pub const LinuxDynLib = struct { const bytes = @intToPtr([*]align(std.os.page_size) u8, addr)[0..size]; - return DynLib{ + return DynLib.{ .allocator = allocator, .elf_lib = try ElfLib.init(bytes), .fd = fd, @@ -63,7 +63,7 @@ pub const LinuxDynLib = struct { } }; -pub const ElfLib = struct { +pub const ElfLib = struct.{ strings: [*]u8, syms: [*]elf.Sym, hashtab: [*]linux.Elf_Symndx, @@ -120,7 +120,7 @@ pub const ElfLib = struct { } } - return ElfLib { + return ElfLib.{ .base = base, .strings = maybe_strings orelse return error.ElfStringSectionNotFound, .syms = maybe_syms orelse return error.ElfSymSectionNotFound, @@ -168,14 +168,14 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ return mem.eql(u8, vername, cstr.toSliceConst(strings + aux.vda_name)); } -pub const WindowsDynLib = struct { +pub const WindowsDynLib = struct.{ allocator: *mem.Allocator, dll: windows.HMODULE, pub fn open(allocator: *mem.Allocator, path: []const u8) !WindowsDynLib { const wpath = try win_util.sliceToPrefixedFileW(path); - - return WindowsDynLib { + + return WindowsDynLib.{ .allocator = allocator, .dll = windows.LoadLibraryW(&wpath) orelse { const err = windows.GetLastError(); @@ -203,7 +203,7 @@ test "dynamic_library" { const libname = switch (builtin.os) { Os.linux => "invalid_so.so", Os.windows => "invalid_dll.dll", - else => return;, + else => return, }; const dynlib = DynLib.open(std.debug.global_allocator, libname) catch |err| { |
