* Added fpc_dynarray_assign (a helper for dynamic array assignments), added local access to fpc_intf_assign, and switched fpc_copy to use assignment helpers instead of incr_ref/decr_ref combinations.

git-svn-id: trunk@20114 -
This commit is contained in:
sergei 2012-01-19 17:43:37 +00:00
parent ac80391c74
commit 568ef396fb
4 changed files with 14 additions and 15 deletions

View File

@ -64,6 +64,7 @@ procedure fpc_dynarray_clear(var p : pointer;ti : pointer); compilerproc;
procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer); compilerproc;
procedure fpc_dynarray_incr_ref(p : pointer); compilerproc;
procedure fpc_dynarray_setlength(var p : pointer;pti : pointer; dimcount : sizeint;dims : pdynarrayindex); compilerproc;
procedure fpc_dynarray_assign(var dest : pointer; src : pointer; ti: pointer); compilerproc;
{$endif FPC_HAS_FEATURE_DYNARRAYS}
{ Str() support }

View File

@ -134,6 +134,15 @@ procedure fpc_dynarray_incr_ref(p : pointer);[Public,Alias:'FPC_DYNARRAY_INCR_RE
procedure fpc_dynarray_incr_ref(p : pointer); [external name 'FPC_DYNARRAY_INCR_REF'];
procedure fpc_dynarray_assign(var dest: Pointer; src: Pointer; ti: pointer);[public,alias:'FPC_DYNARRAY_ASSIGN']; compilerproc;
begin
fpc_dynarray_incr_ref(src);
fpc_dynarray_decr_ref(dest,ti);
Dest:=Src;
end;
procedure fpc_dynarray_assign(var dest: Pointer; src: Pointer; ti: pointer);[external name 'FPC_DYNARRAY_ASSIGN'];
{ provide local access to dynarr_setlength }
procedure int_dynarray_setlength(var p : pointer;pti : pointer;
dimcount : sizeint;dims : pdynarrayindex);[external name 'FPC_DYNARR_SETLENGTH'];

View File

@ -82,6 +82,7 @@
D:=S;
end;
procedure fpc_intf_assign(var D: pointer; const s: pointer); [external name 'FPC_INTF_ASSIGN'];
{procedure fpc_intf_assign_by_iid(var D: pointer; const S: pointer; const iid: TGUID);[public,alias: 'FPC_INTF_ASSIGN2']; compilerproc;
var

View File

@ -275,11 +275,7 @@ begin
case PByte(TypeInfo)^ of
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}
tkAstring:
begin
fpc_AnsiStr_Incr_Ref(PPointer(Src)^);
fpc_AnsiStr_Decr_Ref(PPointer(Dest)^);
PPointer(Dest)^:=PPointer(Src)^;
end;
fpc_AnsiStr_Assign(PPointer(Dest)^,PPointer(Src)^);
{$endif FPC_HAS_FEATURE_ANSISTRINGS}
{$ifdef FPC_HAS_FEATURE_WIDESTRINGS}
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
@ -325,18 +321,10 @@ begin
end;
{$ifdef FPC_HAS_FEATURE_DYNARRAYS}
tkDynArray:
begin
fpc_dynarray_Incr_Ref(PPointer(Src)^);
fpc_dynarray_Decr_Ref(PPointer(Dest)^,typeinfo);
PPointer(Dest)^:=PPointer(Src)^;
end;
fpc_dynarray_assign(PPointer(Dest)^,PPointer(Src)^,typeinfo);
{$endif FPC_HAS_FEATURE_DYNARRAYS}
tkInterface:
begin
Intf_Incr_Ref(PPointer(Src)^);
Intf_Decr_Ref(PPointer(Dest)^);
PPointer(Dest)^:=PPointer(Src)^;
end;
fpc_intf_assign(PPointer(Dest)^,PPointer(Src)^);
{$ifdef FPC_HAS_FEATURE_VARIANTS}
tkVariant:
begin