Skip to content

Commit bf912f6

Browse files
committed
Updated to luajit-build 1.5.4, Zig 0.15.0-dev.565+8e72a2528
1 parent 94418c4 commit bf912f6

File tree

10 files changed

+23
-16
lines changed

10 files changed

+23
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ checks in `Debug` and `ReleaseSafe` builds and provides full test coverage of th
2323

2424
## Zig Version
2525

26-
The `main` branch targets recent builds of Zig's `master` branch (last tested with Zig `0.14.0`).
26+
The `main` branch targets recent builds of Zig's `master` branch (last tested with Zig `0.15.0-dev.565+8e72a2528`).
2727

2828
## Installation & Usage
2929

build.zig.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.{
22
.name = .luajit,
33
.fingerprint = 0xda4bba66d285c19c,
4-
.version = "1.5.3",
4+
.version = "1.5.4",
55
.dependencies = .{
66
.luajit_build = .{
7-
.url = "git+https://github.com/sackosoft/zig-luajit-build#8bb843189b32ada74741c51b7f88c32f45f5f7f2",
8-
.hash = "luajit_build-1.1.3-HFjoU2o7AABpwlsfVuxG9YbpjRYmD4LwVa2WPCod3YKC",
7+
.url = "git+https://github.com/sackosoft/zig-luajit-build#d75c20acaa4df39f51187926fa9d98e4e5231064",
8+
.hash = "luajit_build-1.1.4-HFjoU14-AACEEcPwP8nRnDSLS3EByuR8u5ZWAXBq08PH",
99
},
1010
},
1111
.paths = .{
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528
2+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528
2+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528
2+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528
2+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528
2+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528
2+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.14.0
1+
0.15.0-dev.565+8e72a2528

src/allocator_adapter.zig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
const std = @import("std");
55

6-
const max = @alignOf(std.c.max_align_t);
6+
const max_alignment: std.mem.Alignment = std.mem.Alignment.of(std.c.max_align_t);
7+
const max_alignment_bytes: usize = std.mem.Alignment.toByteUnits(max_alignment);
78

89
pub const AllocationUserdata = struct {
910
alloc: std.mem.Allocator,
@@ -14,7 +15,7 @@ pub const AllocFn = fn (
1415
ptr: ?*anyopaque,
1516
osize: usize,
1617
nsize: usize,
17-
) callconv(.C) ?*align(max) anyopaque;
18+
) callconv(.C) ?*align(max_alignment_bytes) anyopaque;
1819

1920
/// Memory allocation function used by Lua instances. This functino acts as an adaptor from the C API to the
2021
/// idiomatic Zig `std.mem.Allocator` type. The implementation provides functionality similar to realloc.
@@ -36,12 +37,12 @@ pub const AllocFn = fn (
3637
///
3738
/// From: `void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);`
3839
/// Refer to: https://www.lua.org/manual/5.1/manual.html#lua_Alloc
39-
pub fn alloc(ud: ?*anyopaque, ptr: ?*anyopaque, osize: usize, nsize: usize) callconv(.C) ?*align(max) anyopaque {
40+
pub fn alloc(ud: ?*anyopaque, ptr: ?*anyopaque, osize: usize, nsize: usize) callconv(.C) ?*align(max_alignment_bytes) anyopaque {
4041
std.debug.assert(ud != null);
4142

4243
const user_data: *AllocationUserdata = @ptrCast(@alignCast(ud.?));
4344
const allocator: std.mem.Allocator = user_data.alloc;
44-
const aligned_ptr = @as(?[*]align(max) u8, @ptrCast(@alignCast(ptr)));
45+
const aligned_ptr = @as(?[*]align(max_alignment_bytes) u8, @ptrCast(@alignCast(ptr)));
4546
if (aligned_ptr) |p| {
4647
if (nsize != 0) {
4748
const old_mem = p[0..osize];
@@ -52,6 +53,6 @@ pub fn alloc(ud: ?*anyopaque, ptr: ?*anyopaque, osize: usize, nsize: usize) call
5253
return null;
5354
} else {
5455
// Malloc case
55-
return (allocator.alignedAlloc(u8, max, nsize) catch return null).ptr;
56+
return (allocator.alignedAlloc(u8, max_alignment, nsize) catch return null).ptr;
5657
}
5758
}

0 commit comments

Comments
 (0)