termio: fix some mild memory corruption

This commit is contained in:
Mitchell Hashimoto
2024-11-13 12:55:43 -08:00
parent 3ca246ceb9
commit e724c46c64

View File

@ -194,9 +194,9 @@ pub fn MessageData(comptime Elem: type, comptime small_size: comptime_int) type
}
/// Returns a const slice of the data pointed to by this request.
pub fn slice(self: Self) []const Elem {
return switch (self) {
.small => |v| v.data[0..v.len],
pub fn slice(self: *const Self) []const Elem {
return switch (self.*) {
.small => |*v| v.data[0..v.len],
.stable => |v| v,
.alloc => |v| v.data,
};