since this is the only usecase, return a *libusbDevice for a new
pointer.
This commit is contained in:
@@ -306,7 +306,7 @@ func newFakeLibusb() *fakeLibusb {
|
|||||||
// without using the full USB stack. Since the fake library uses the
|
// without using the full USB stack. Since the fake library uses the
|
||||||
// libusbDevice only as an identifier, use an arbitrary unique pointer.
|
// libusbDevice only as an identifier, use an arbitrary unique pointer.
|
||||||
// The contents of these pointers is never accessed.
|
// The contents of these pointers is never accessed.
|
||||||
fl.fakeDevices[(*libusbDevice)(newCPointer())] = &fakeDevice{
|
fl.fakeDevices[newDevicePointer()] = &fakeDevice{
|
||||||
desc: d,
|
desc: d,
|
||||||
alt: 0,
|
alt: 0,
|
||||||
}
|
}
|
||||||
|
@@ -426,6 +426,6 @@ func libusbSetDebug(c *libusbContext, lvl int) {
|
|||||||
C.libusb_set_debug((*C.libusb_context)(c), C.int(lvl))
|
C.libusb_set_debug((*C.libusb_context)(c), C.int(lvl))
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCPointer() unsafe.Pointer {
|
func newDevicePointer() *libusbDevice {
|
||||||
return unsafe.Pointer(C.malloc(1))
|
return (*libusbDevice)(unsafe.Pointer(C.malloc(1)))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user