Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Audio.zig
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn init(audio: *Audio, audio_mod: mach.Mod(Audio)) !void {
"MACH_DEBUG_AUDIO",
) catch |err| switch (err) {
error.EnvironmentVariableNotFound => null,
else => return err,
else => |e| return e,
};
const debug = if (debug_str) |s| blk: {
defer allocator.free(s);
Expand Down
2 changes: 1 addition & 1 deletion src/Core.zig
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ pub fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType {
if (builtin.target.os.tag == .windows) return .d3d12;
return .vulkan;
},
else => return err,
else => |e| return e,
};
defer allocator.free(backend);

Expand Down
2 changes: 1 addition & 1 deletion src/core/Linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn initWindow(
// default backend
break :blk .wayland;
},
else => return err,
else => |e| return e,
};
defer core.allocator.free(backend);

Expand Down
4 changes: 2 additions & 2 deletions src/core/linux/Wayland.zig
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const LibXkbCommon = struct {

pub fn load() !LibXkbCommon {
var lib: LibXkbCommon = undefined;
lib.handle = try mach.dynLibOpen("libxkbcommon.so.0");
lib.handle = try mach.dynLibOpen("libxkbcommon.so");
inline for (@typeInfo(LibXkbCommon).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand Down Expand Up @@ -327,7 +327,7 @@ const LibWaylandClient = struct {

pub fn load() !LibWaylandClient {
var lib: LibWaylandClient = undefined;
lib.handle = try mach.dynLibOpen("libwayland-client.so.0");
lib.handle = try mach.dynLibOpen("libwayland-client.so");
inline for (@typeInfo(LibWaylandClient).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand Down
16 changes: 8 additions & 8 deletions src/core/linux/X11.zig
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ pub fn initWindow(
_ = libx11.XInitThreads();
const libgl: ?LibGL = LibGL.load() catch |err| switch (err) {
error.LibraryNotFound => null,
else => return err,
else => |e| return e,
};
const libxcursor: ?LibXCursor = LibXCursor.load() catch |err| switch (err) {
error.LibraryNotFound => null,
else => return err,
else => |e| return e,
};
const libxrr: ?LibXRR = LibXRR.load() catch |err| switch (err) {
error.LibraryNotFound => null,
else => return err,
else => |e| return e,
};
const display = libx11.XOpenDisplay(null) orelse {
return error.FailedToConnectToDisplay;
Expand Down Expand Up @@ -439,7 +439,7 @@ const LibX11 = struct {
XFree: *const @TypeOf(c.XFree),
pub fn load() !LibX11 {
var lib: LibX11 = undefined;
lib.handle = try mach.dynLibOpen("libX11.so.6");
lib.handle = try mach.dynLibOpen("libX11.so");
inline for (@typeInfo(LibX11).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand All @@ -459,7 +459,7 @@ const LibXCursor = struct {
XcursorLibraryLoadImage: *const @TypeOf(c.XcursorLibraryLoadImage),
pub fn load() !LibXCursor {
var lib: LibXCursor = undefined;
lib.handle = try mach.dynLibOpen("libXcursor.so.1");
lib.handle = try mach.dynLibOpen("libXcursor.so");
inline for (@typeInfo(LibXCursor).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand All @@ -475,7 +475,7 @@ const LibXRR = struct {
XRRConfigCurrentRate: *const @TypeOf(c.XRRConfigCurrentRate),
pub fn load() !LibXRR {
var lib: LibXRR = undefined;
lib.handle = try mach.dynLibOpen("libXrandr.so.1");
lib.handle = try mach.dynLibOpen("libXrandr.so");
inline for (@typeInfo(LibXRR).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand Down Expand Up @@ -506,7 +506,7 @@ const LibGL = struct {
glXSwapBuffers: *const fn (*c.Display, Drawable) callconv(.C) bool,
pub fn load() !LibGL {
var lib: LibGL = undefined;
lib.handle = try mach.dynLibOpen("libGL.so.1");
lib.handle = try mach.dynLibOpen("libGL.so");
inline for (@typeInfo(LibGL).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand Down Expand Up @@ -538,7 +538,7 @@ const LibXkbCommon = struct {

pub fn load() !LibXkbCommon {
var lib: LibXkbCommon = undefined;
lib.handle = try mach.dynLibOpen("libxkbcommon.so.0");
lib.handle = try mach.dynLibOpen("libxkbcommon.so");
inline for (@typeInfo(LibXkbCommon).@"struct".fields[1..]) |field| {
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
Expand Down
2 changes: 1 addition & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub inline fn dynLibOpen(libName: []const u8) !std.DynLib {
log.err("Missing system library: '{s}'!", .{libName});
return error.LibraryNotFound;
},
else => return err,
else => |e| return e,
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/sysgpu/d3d12.zig
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ pub const MemoryAllocator = struct {
if (heap.*) |*h| {
const allocation = h.gpu_allocator.allocate(@intCast(size)) catch |err| switch (err) {
gpu_allocator.Error.OutOfMemory => continue,
else => return err,
else => |e| return e,
};
return GroupAllocation{
.allocation = allocation,
Expand Down
2 changes: 1 addition & 1 deletion src/sysgpu/vulkan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn init(alloc: std.mem.Allocator, options: InitOptions) !void {
} else {
libvulkan = try mach.dynLibOpen(switch (builtin.target.os.tag) {
.windows => "vulkan-1.dll",
.linux => "libvulkan.so.1",
.linux => "libvulkan.so",
.macos => "libvulkan.1.dylib",
else => @compileError("Unknown OS!"),
});
Expand Down
Loading