Skip to content

Commit e6e7402

Browse files
committed
Fix build with Go 1.24
1 parent f91e4d0 commit e6e7402

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

go/cpossum/c-possum.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func mapError(err C.PossumError) error {
4747
return Error{pec: err}
4848
}
4949

50-
type Stat = C.PossumStat
50+
type Stat C.PossumStat
5151

5252
func (me Stat) LastUsed() time.Time {
5353
ts := me.last_used
@@ -58,6 +58,10 @@ func (me Stat) Size() int64 {
5858
return int64(me.size)
5959
}
6060

61+
func (me *Stat) AsCPtr() *C.PossumStat {
62+
return (*C.PossumStat)(unsafe.Pointer(me))
63+
}
64+
6165
type Handle = C.PossumHandle
6266

6367
func NewHandle(dir string) *Handle {
@@ -72,7 +76,7 @@ func DropHandle(handle *Handle) {
7276
}
7377

7478
func SingleDelete(handle *Handle, key string) (opt generics.Option[Stat], err error) {
75-
pe := C.possum_single_delete(handle, BufFromString(key), &opt.Value)
79+
pe := C.possum_single_delete(handle, BufFromString(key), opt.Value.AsCPtr())
7680
switch pe {
7781
case C.NoError:
7882
opt.Ok = true
@@ -87,7 +91,7 @@ func SingleStat(handle *Handle, key string) (opt generics.Option[Stat]) {
8791
opt.Ok = bool(C.possum_single_stat(
8892
handle,
8993
BufFromString(key),
90-
&opt.Value,
94+
opt.Value.AsCPtr(),
9195
))
9296
return
9397
}
@@ -114,7 +118,7 @@ func goListItems(items *C.PossumItem, itemsLen C.size_t) (goItems []Item) {
114118
C.int(from.key.size),
115119
)
116120
C.free(unsafe.Pointer(from.key.ptr))
117-
to.Stat = from.stat
121+
to.Stat = Stat(from.stat)
118122
}
119123
C.free(unsafe.Pointer(items))
120124
return
@@ -207,7 +211,7 @@ func ValueReadAt(v Value, buf []byte, offset int64) (n int, err error) {
207211
}
208212

209213
func ValueStat(v Value) (ret Stat) {
210-
C.possum_value_stat(v, &ret)
214+
C.possum_value_stat(v, ret.AsCPtr())
211215
return
212216
}
213217

0 commit comments

Comments
 (0)