mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 02:10:22 +02:00
* read ansistring speedup (no length(s) calls anymore)
This commit is contained in:
parent
5726bd1684
commit
60854f1f6c
@ -781,18 +781,17 @@ End;
|
|||||||
|
|
||||||
Procedure Read_AnsiString(var f : TextRec;var s : AnsiString);[Public,Alias:'FPC_READ_TEXT_ANSISTR'];
|
Procedure Read_AnsiString(var f : TextRec;var s : AnsiString);[Public,Alias:'FPC_READ_TEXT_ANSISTR'];
|
||||||
var
|
var
|
||||||
len : longint;
|
slen,len : longint;
|
||||||
Begin
|
Begin
|
||||||
{ Delete the string }
|
slen:=0;
|
||||||
Setlength(S,0);
|
|
||||||
Repeat
|
Repeat
|
||||||
// SetLength will reallocate the length.
|
// SetLength will reallocate the length.
|
||||||
SetLength(S,Length(S)+255);
|
SetLength(S,slen+255);
|
||||||
len:=ReadPCharLen(f,pchar(Pointer(S)+Length(S)-255),255);
|
len:=ReadPCharLen(f,pchar(Pointer(S)+slen),255);
|
||||||
If Len<255 then
|
inc(slen,len);
|
||||||
// Set actual length
|
|
||||||
SetLength(S,Length(S)-255+Len);
|
|
||||||
Until len<255;
|
Until len<255;
|
||||||
|
// Set actual length
|
||||||
|
SetLength(S,Slen);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -950,7 +949,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.57 1999-09-10 17:14:43 peter
|
Revision 1.58 1999-10-04 20:42:45 peter
|
||||||
|
* read ansistring speedup (no length(s) calls anymore)
|
||||||
|
|
||||||
|
Revision 1.57 1999/09/10 17:14:43 peter
|
||||||
* remove CR when reading one char less then size
|
* remove CR when reading one char less then size
|
||||||
|
|
||||||
Revision 1.56 1999/09/10 15:40:33 peter
|
Revision 1.56 1999/09/10 15:40:33 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user