mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 02:59:13 +02:00
* Fix bug #34087: Small optimization of StrlComp
git-svn-id: trunk@39563 -
This commit is contained in:
parent
473a028523
commit
08d574bf7d
@ -760,13 +760,16 @@ function StrLComp (Str1, Str2: PRegExprChar; MaxLen: PtrUInt): PtrInt;
|
|||||||
|
|
||||||
var
|
var
|
||||||
S1, S2: RegExprString;
|
S1, S2: RegExprString;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
S1 := Str1;
|
S1 := Str1;
|
||||||
S2 := Str2;
|
S2 := Str2;
|
||||||
if Copy (S1, 1, MaxLen) > Copy (S2, 1, MaxLen) then
|
if Length(S1) > MaxLen then
|
||||||
|
SetLength(S1, MaxLen);
|
||||||
|
if Length(S2) > MaxLen then
|
||||||
|
SetLength(S2, MaxLen);
|
||||||
|
if S1 > S2 then
|
||||||
Result := 1
|
Result := 1
|
||||||
else if Copy (S1, 1, MaxLen) < Copy (S2, 1, MaxLen) then
|
else if S2 < S2 then
|
||||||
Result := -1
|
Result := -1
|
||||||
else
|
else
|
||||||
Result := 0;
|
Result := 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user