mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 10:20:21 +02:00
* Minor improvement. No need to move the terminating null char, since it is written later anyway. Remove a local var.
git-svn-id: trunk@44960 -
This commit is contained in:
parent
ef790adc28
commit
1e32b96bc2
@ -766,8 +766,7 @@ Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_H
|
||||
}
|
||||
Var
|
||||
Temp : Pointer;
|
||||
lens, lena,
|
||||
movelen : SizeInt;
|
||||
lens, lena : SizeInt;
|
||||
begin
|
||||
if (l>0) then
|
||||
begin
|
||||
@ -798,13 +797,10 @@ begin
|
||||
{ Reallocation is needed... }
|
||||
Temp:=NewAnsiString(L);
|
||||
PAnsiRec(Pointer(Temp)-AnsiFirstOff)^.CodePage:=PAnsiRec(Pointer(S)-AnsiFirstOff)^.CodePage;
|
||||
{ also move terminating null }
|
||||
lens:=succ(length(s));
|
||||
lens:=length(s);
|
||||
if l<lens then
|
||||
movelen:=l
|
||||
else
|
||||
movelen:=lens;
|
||||
Move(Pointer(S)^,Temp^,movelen);
|
||||
lens:=l;
|
||||
Move(Pointer(S)^,Temp^,lens);
|
||||
fpc_ansistr_decr_ref(Pointer(s));
|
||||
Pointer(S):=Temp;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user