mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 15:29:14 +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
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
SEL_alloc : SEL = nil;
|
||||||
|
SEL_init : SEL = nil;
|
||||||
|
SEL_release : SEL = nil;
|
||||||
|
|
||||||
function super(obj: id): objc_super;
|
function super(obj: id): objc_super;
|
||||||
begin
|
begin
|
||||||
Result.reciever := obj;
|
Result.reciever := obj;
|
||||||
@ -57,17 +62,20 @@ end;
|
|||||||
|
|
||||||
procedure release(objc: id); inline;
|
procedure release(objc: id); inline;
|
||||||
begin
|
begin
|
||||||
objc_msgSend(objc, selector('release'), []);
|
if SEL_release=nil then SEL_release := selector('release');
|
||||||
|
objc_msgSend(objc, SEL_release, []);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function AllocAndInit(classname: PChar): id; inline;
|
function AllocAndInit(classname: PChar): id; inline;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
function AllocAndInitEx(classname: PChar; extraBytes: Integer): id; inline;
|
function AllocAndInitEx(classname: PChar; extraBytes: Integer): id; inline;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user