mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 08:09:33 +02:00
objcrtlutils: added SELectors caching for alloc, init and release methods
git-svn-id: trunk@13318 -
This commit is contained in:
parent
68d937d120
commit
4784948a75
@ -28,6 +28,11 @@ function super(obj: id): objc_super;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
SEL_alloc : SEL = nil;
|
||||
SEL_init : SEL = nil;
|
||||
SEL_release : SEL = nil;
|
||||
|
||||
function super(obj: id): objc_super;
|
||||
begin
|
||||
Result.reciever := obj;
|
||||
@ -57,17 +62,20 @@ end;
|
||||
|
||||
procedure release(objc: id); inline;
|
||||
begin
|
||||
objc_msgSend(objc, selector('release'), []);
|
||||
if SEL_release=nil then SEL_release := selector('release');
|
||||
objc_msgSend(objc, SEL_release, []);
|
||||
end;
|
||||
|
||||
function AllocAndInit(classname: PChar): id; inline;
|
||||
begin
|
||||
Result:= objc_msgSend( alloc( classname ), selector('init'), []);
|
||||
if SEL_init=nil then SEL_init := selector('init');
|
||||
Result:= objc_msgSend( alloc( classname ), SEL_init, []);
|
||||
end;
|
||||
|
||||
function AllocAndInitEx(classname: PChar; extraBytes: Integer): id; inline;
|
||||
begin
|
||||
Result := objc_msgSend( allocEx( classname, extraBytes ), selector('init'), []);
|
||||
if SEL_init=nil then SEL_init := selector('init');
|
||||
Result := objc_msgSend( allocEx( classname, extraBytes ), SEL_init, []);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user