darwin: moved type definitions near methods definition
This commit is contained in:
@@ -18,26 +18,6 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type io_iterator_t struct {
|
|
||||||
ioiterator C.io_iterator_t
|
|
||||||
}
|
|
||||||
|
|
||||||
type io_object_t struct {
|
|
||||||
ioobject C.io_object_t
|
|
||||||
}
|
|
||||||
|
|
||||||
type io_registry_entry_t struct {
|
|
||||||
ioregistryentry C.io_registry_entry_t
|
|
||||||
}
|
|
||||||
|
|
||||||
type cfStringRef struct {
|
|
||||||
cfs C.CFStringRef
|
|
||||||
}
|
|
||||||
|
|
||||||
type cfTypeRef struct {
|
|
||||||
cft C.CFTypeRef
|
|
||||||
}
|
|
||||||
|
|
||||||
func nativeGetDetailedPortsList() ([]*PortDetails, error) {
|
func nativeGetDetailedPortsList() ([]*PortDetails, error) {
|
||||||
var ports []*PortDetails
|
var ports []*PortDetails
|
||||||
|
|
||||||
@@ -158,6 +138,10 @@ func getMatchingServices(matcher C.CFMutableDictionaryRef) (io_iterator_t, error
|
|||||||
|
|
||||||
// cfStringRef
|
// cfStringRef
|
||||||
|
|
||||||
|
type cfStringRef struct {
|
||||||
|
cfs C.CFStringRef
|
||||||
|
}
|
||||||
|
|
||||||
func CFStringCreateWithString(s string) cfStringRef {
|
func CFStringCreateWithString(s string) cfStringRef {
|
||||||
c := C.CString(s)
|
c := C.CString(s)
|
||||||
defer C.free(unsafe.Pointer(c))
|
defer C.free(unsafe.Pointer(c))
|
||||||
@@ -172,12 +156,20 @@ func (ref cfStringRef) Release() {
|
|||||||
|
|
||||||
// CFTypeRef
|
// CFTypeRef
|
||||||
|
|
||||||
|
type cfTypeRef struct {
|
||||||
|
cft C.CFTypeRef
|
||||||
|
}
|
||||||
|
|
||||||
func (ref cfTypeRef) Release() {
|
func (ref cfTypeRef) Release() {
|
||||||
C.CFRelease(C.CFTypeRef(ref.cft))
|
C.CFRelease(C.CFTypeRef(ref.cft))
|
||||||
}
|
}
|
||||||
|
|
||||||
// io_registry_entry_t
|
// io_registry_entry_t
|
||||||
|
|
||||||
|
type io_registry_entry_t struct {
|
||||||
|
ioregistryentry C.io_registry_entry_t
|
||||||
|
}
|
||||||
|
|
||||||
func (me *io_registry_entry_t) GetParent(plane string) (io_registry_entry_t, error) {
|
func (me *io_registry_entry_t) GetParent(plane string) (io_registry_entry_t, error) {
|
||||||
cPlane := C.CString(plane)
|
cPlane := C.CString(plane)
|
||||||
defer C.free(unsafe.Pointer(cPlane))
|
defer C.free(unsafe.Pointer(cPlane))
|
||||||
@@ -234,6 +226,10 @@ func (me *io_registry_entry_t) GetIntProperty(key string, intType C.CFNumberType
|
|||||||
|
|
||||||
// io_iterator_t
|
// io_iterator_t
|
||||||
|
|
||||||
|
type io_iterator_t struct {
|
||||||
|
ioiterator C.io_iterator_t
|
||||||
|
}
|
||||||
|
|
||||||
// IsValid checks if an iterator is still valid.
|
// IsValid checks if an iterator is still valid.
|
||||||
// Some iterators will be made invalid if changes are made to the
|
// Some iterators will be made invalid if changes are made to the
|
||||||
// structure they are iterating over. This function checks the iterator
|
// structure they are iterating over. This function checks the iterator
|
||||||
@@ -258,6 +254,10 @@ func (me *io_iterator_t) Release() {
|
|||||||
|
|
||||||
// io_object_t
|
// io_object_t
|
||||||
|
|
||||||
|
type io_object_t struct {
|
||||||
|
ioobject C.io_object_t
|
||||||
|
}
|
||||||
|
|
||||||
func (me *io_object_t) Release() {
|
func (me *io_object_t) Release() {
|
||||||
C.IOObjectRelease(me.ioobject)
|
C.IOObjectRelease(me.ioobject)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user