Val is now passed to helpers directly instead of through extra pointer. (#31)

Co-authored-by: Zachary Levy <zachary@sunforge.is>
Reviewed-on: #31
This commit was merged in pull request #31.
This commit is contained in:
2026-06-04 21:50:55 +00:00
parent 6ac41b22f8
commit f2da356580
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -186,7 +186,7 @@ blittable_val :: #force_inline proc(val_ptr: ^$T) -> Val {
// Reads a blittable T out of the LMDB memory map by copying it into caller
// storage. The returned T has no lifetime tie to the transaction.
blittable_copy :: #force_inline proc(val: ^Val, $T: typeid) -> T {
blittable_copy :: #force_inline proc(val: Val, $T: typeid) -> T {
fmt.assertf(
reflect.has_no_indirections(type_info_of(T)),
"blitval_copy: type '%v' contains indirection and cannot be read directly from LMDB",
@@ -202,7 +202,7 @@ blittable_copy :: #force_inline proc(val: ^Val, $T: typeid) -> T {
// or silently corrupt the database (ENV_WRITEMAP).
// MUST NOT be retained past txn_commit, txn_abort, or any subsequent write
// operation on the same env — the pointer is invalidated.
blittable_view :: #force_inline proc(val: ^Val, $T: typeid) -> ^T {
blittable_view :: #force_inline proc(val: Val, $T: typeid) -> ^T {
fmt.assertf(
reflect.has_no_indirections(type_info_of(T)),
"blitval_view: type '%v' contains indirection and cannot be viewed directly from LMDB",
@@ -231,7 +231,7 @@ slice_val :: #force_inline proc(s: []$T) -> Val {
// MUST be copied (e.g. slice.clone) if it needs to outlive the current
// transaction; the view is invalidated by txn_commit, txn_abort, or any
// subsequent write operation on the same env.
slice_view :: #force_inline proc(val: ^Val, $T: typeid) -> []T {
slice_view :: #force_inline proc(val: Val, $T: typeid) -> []T {
fmt.assertf(
reflect.has_no_indirections(type_info_of(T)),
"slice_view: element type '%v' contains indirection and cannot be read directly from LMDB",
@@ -253,7 +253,7 @@ string_val :: #force_inline proc(s: string) -> Val {
// MUST be copied (e.g. strings.clone) if it needs to outlive the current
// transaction; the view is invalidated by txn_commit, txn_abort, or any
// subsequent write operation on the same env.
string_view :: #force_inline proc(val: ^Val) -> string {
string_view :: #force_inline proc(val: Val) -> string {
return string((cast([^]u8)val.data)[:val.size])
}