mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 00:59:08 +02:00
* code of ansitr_concat improved
This commit is contained in:
parent
5050f1ff66
commit
67f6ce5348
@ -182,19 +182,21 @@ Procedure fpc_AnsiStr_Concat (const S1,S2 : ansistring;var S3 : ansistring);[Pub
|
|||||||
Var
|
Var
|
||||||
Size,Location : Longint;
|
Size,Location : Longint;
|
||||||
begin
|
begin
|
||||||
{ only assign if s1 or s2 is empty }
|
{ only assign if s1 or s2 is empty }
|
||||||
if (S1='') then
|
if (S1='') then
|
||||||
s3 := s2
|
s3 := s2
|
||||||
else
|
else if (S2='') then
|
||||||
if (S2='') then
|
s3 := s1
|
||||||
s3 := s1
|
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Size:=length(S2);
|
Size:=length(S2);
|
||||||
Location:=Length(S1);
|
Location:=Length(S1);
|
||||||
SetLength (S3,Size+Location);
|
SetLength (S3,Size+Location);
|
||||||
Move (S1[1],S3[1],Location);
|
{ the cast to a pointer avoids the unique call }
|
||||||
Move (S2[1],S3[location+1],Size+1);
|
{ and we don't need an unique call }
|
||||||
|
{ because of the SetLength S3 is unique }
|
||||||
|
Move (S1[1],pointer(S3)^,Location);
|
||||||
|
Move (S2[1],pointer(pointer(S3)+location)^,Size+1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -798,7 +800,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2001-08-30 15:43:15 jonas
|
Revision 1.22 2001-11-17 23:58:12 florian
|
||||||
|
* code of ansitr_concat improved
|
||||||
|
|
||||||
|
Revision 1.21 2001/08/30 15:43:15 jonas
|
||||||
* converted adding/comparing of strings to compileproc. Note that due
|
* converted adding/comparing of strings to compileproc. Note that due
|
||||||
to the way the shortstring helpers for i386 are written, they are
|
to the way the shortstring helpers for i386 are written, they are
|
||||||
still handled by the old code (reason: fpc_shortstr_compare returns
|
still handled by the old code (reason: fpc_shortstr_compare returns
|
||||||
|
Loading…
Reference in New Issue
Block a user