Removed objc_new(). The idea is to remove all the objc_* functions that aren't prefixed with C. (except objc_getClass()).

This commit is contained in:
Pietro Gagliardi 2014-04-04 17:50:27 -04:00
parent 1a7bf4cd89
commit 3a130b756a
5 changed files with 4 additions and 8 deletions

View File

@ -64,7 +64,7 @@ func mkAppDelegate() error {
if err != nil { if err != nil {
return fmt.Errorf("error adding NSApplication delegate buttonClicked: method (to handle button clicks): %v", err) return fmt.Errorf("error adding NSApplication delegate buttonClicked: method (to handle button clicks): %v", err)
} }
appDelegate = objc_new(objc_getClass(_goAppDelegate)) appDelegate = C.objc_msgSend_noargs(objc_getClass(_goAppDelegate), _new)
return nil return nil
} }

View File

@ -31,7 +31,7 @@ func _msgBox(primarytext string, secondarytext string, style uintptr, button0 st
ret := make(chan struct{}) ret := make(chan struct{})
defer close(ret) defer close(ret)
uitask <- func() { uitask <- func() {
box := objc_new(_NSAlert) box := C.objc_msgSend_noargs(_NSAlert, _new)
C.objc_msgSend_id(box, _setMessageText, toNSString(primarytext)) C.objc_msgSend_id(box, _setMessageText, toNSString(primarytext))
C.objc_msgSend_id(box, _setInformativeText, toNSString(secondarytext)) C.objc_msgSend_id(box, _setInformativeText, toNSString(secondarytext))
objc_msgSend_uint(box, _setAlertStyle, style) objc_msgSend_uint(box, _setAlertStyle, style)

View File

@ -85,7 +85,7 @@ var (
) )
func newListboxArray() C.id { func newListboxArray() C.id {
array := objc_new(_NSArrayController) array := C.objc_msgSend_noargs(_NSArrayController, _new)
C.objc_msgSend_bool(array, _setAutomaticallyRearrangesObjects, C.BOOL(C.NO)) C.objc_msgSend_bool(array, _setAutomaticallyRearrangesObjects, C.BOOL(C.NO))
return array return array
} }

View File

@ -43,10 +43,6 @@ func objc_alloc(class C.id) C.id {
return C.objc_msgSend_noargs(class, _alloc) return C.objc_msgSend_noargs(class, _alloc)
} }
func objc_new(class C.id) C.id {
return C.objc_msgSend_noargs(class, _new)
}
func objc_release(obj C.id) { func objc_release(obj C.id) {
C.objc_msgSend_noargs(obj, _release) C.objc_msgSend_noargs(obj, _release)
} }

View File

@ -41,7 +41,7 @@ func ui(main func()) error {
go func() { go func() {
for f := range uitask { for f := range uitask {
// we need to make an NSAutoreleasePool, otherwise we get leak warnings on stderr // we need to make an NSAutoreleasePool, otherwise we get leak warnings on stderr
pool := objc_new(_NSAutoreleasePool) pool := C.objc_msgSend_noargs(_NSAutoreleasePool, _new)
fp := C.objc_msgSend_ptr(_NSValue, _valueWithPointer, fp := C.objc_msgSend_ptr(_NSValue, _valueWithPointer,
unsafe.Pointer(&f)) unsafe.Pointer(&f))
C.objc_msgSend_sel_id_bool( C.objc_msgSend_sel_id_bool(