* Patch with small speed improvements from Luiz Americo (Bug ID 17240 )

git-svn-id: trunk@15878 -
This commit is contained in:
michael 2010-08-23 07:45:55 +00:00
parent a848b6fde2
commit 4144176f2f
2 changed files with 5 additions and 6 deletions

View File

@ -30,7 +30,7 @@ Type
FScanner : TJSONScanner;
function ParseNumber: TJSONNumber;
Protected
procedure DoError(Msg: String);
procedure DoError(const Msg: String);
function DoParse(AtCurrent,AllowEOF: Boolean): TJSONData;
function GetNextToken: TJSONToken;
function CurrentTokenString: String;
@ -115,8 +115,7 @@ begin
tkComma : DoError(SErrUnexpectedToken);
end;
except
if assigned(Result) then
FreeAndNil(Result);
FreeAndNil(Result);
Raise;
end;
end;
@ -226,7 +225,7 @@ begin
Until (Result<>tkWhiteSpace);
end;
Procedure TJSONParser.DoError(Msg : String);
Procedure TJSONParser.DoError(const Msg : String);
Var
S : String;

View File

@ -63,7 +63,7 @@ type
function DoFetchToken: TJSONToken;
public
constructor Create(Source : TStream); overload;
constructor Create(Source : String); overload;
constructor Create(const Source : String); overload;
destructor Destroy; override;
function FetchToken: TJSONToken;
@ -104,7 +104,7 @@ begin
FSource.LoadFromStream(Source);
end;
constructor TJSONScanner.Create(Source : String);
constructor TJSONScanner.Create(const Source : String);
begin
FSource:=TStringList.Create;
FSource.Text:=Source;