http://svn.freepascal.org/svn/fpc/trunk/rtl/objpas/sysutils/sysstr.inc InternalChangeCase change proposal
Original Reporter info from Mantis: lagprogramming
-
Reporter name:
Original Reporter info from Mantis: lagprogramming
- Reporter name:
Description:
Changed line
"if Result='' then exit;"
to
"if Result<>'' then
begin"
"end;"
This change should lead to faster execution of two commonly used functions: LowerCase and UpperCase.
Additional information:
COMPLETE ORIGINAL CODE:
Function InternalChangeCase(Const S : AnsiString; const Chars: TSysCharSet; const Adjustment: Longint): AnsiString;
var
i : Integer;
P : PChar;
Unique : Boolean;
begin
Result := S;
if Result='' then
exit;
Unique:=false;
P:=PChar(Result);
for i:=1 to Length(Result) do
begin
if CharInSet(P^,Chars) then
begin
if not Unique then
begin
UniqueString(Result);
p:=@Result[i];
Unique:=true;
end;
P^:=Char(Ord(P^)+Adjustment);
end;
Inc(P);
end;
end;
COMPLETE PROPOSED CODE:
Function InternalChangeCase(Const S : AnsiString; const Chars: TSysCharSet; const Adjustment: Longint): AnsiString;
var
i : Integer;
P : PChar;
Unique : Boolean;
begin
Result := S;
if Result<>'' then
begin
Unique:=false;
P:=PChar(Result);
for i:=1 to Length(Result) do
begin
if CharInSet(P^,Chars) then
begin
if not Unique then
begin
UniqueString(Result);
p:=@Result[i];
Unique:=true;
end;
P^:=Char(Ord(P^)+Adjustment);
end;
Inc(P);
end;
end;
end;
Mantis conversion info:
- Mantis ID: 25651
- Version: 1.0.15 (SVN)