mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 12:20:28 +02:00
* fixed fpc_AnsiStr_Concat in case when strings the same.
git-svn-id: trunk@5958 -
This commit is contained in:
parent
2602ceb7e4
commit
97e6235535
@ -203,6 +203,7 @@ end;
|
||||
procedure fpc_AnsiStr_Concat (var DestS:ansistring;const S1,S2 : AnsiString); compilerproc;
|
||||
Var
|
||||
Size,Location : SizeInt;
|
||||
same : boolean;
|
||||
begin
|
||||
{ only assign if s1 or s2 is empty }
|
||||
if (S1='') then
|
||||
@ -220,8 +221,12 @@ begin
|
||||
{ Use Pointer() typecasts to prevent extra conversion code }
|
||||
if Pointer(DestS)=Pointer(S1) then
|
||||
begin
|
||||
same:=Pointer(S1)=Pointer(S2);
|
||||
SetLength(DestS,Size+Location);
|
||||
Move(Pointer(S2)^,(Pointer(DestS)+Location)^,Size+1);
|
||||
if same then
|
||||
Move(Pointer(DestS)^,(Pointer(DestS)+Location)^,Size)
|
||||
else
|
||||
Move(Pointer(S2)^,(Pointer(DestS)+Location)^,Size+1);
|
||||
end
|
||||
else if Pointer(DestS)=Pointer(S2) then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user