mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 05:29:18 +02:00
* Patch from Rika to fix broken test (tw39885)
This commit is contained in:
parent
44cda17674
commit
1ce1fcf5ae
@ -332,7 +332,7 @@ type
|
||||
|
||||
class var
|
||||
LCaseArray: array[AnsiChar] of AnsiChar; //Array of lowercased alphabet
|
||||
LCaseArrayPrepared: int32; // Atomic, is LCaseArray initialized, 0 = no, 1 = yes.
|
||||
LCaseArrayPrepared: boolean;
|
||||
|
||||
procedure Init(var aMatches: SizeIntArray); inline;
|
||||
procedure MakeDeltaJumpTables(aPattern: PAnsiChar; aPatternSize: SizeInt);
|
||||
@ -377,7 +377,7 @@ begin
|
||||
SuffixLength:=0;
|
||||
while (SuffixLength<Position) and (aPattern[Position-SuffixLength] = aPattern[aPatternSize-1-SuffixLength]) do
|
||||
inc(SuffixLength);
|
||||
if SuffixLength<Position then
|
||||
if aPattern[Position-SuffixLength] <> aPattern[aPatternSize-1-SuffixLength] then
|
||||
DeltaJumpTable2[aPatternSize - 1 - SuffixLength] := aPatternSize - 1 - Position + SuffixLength;
|
||||
Inc(Position);
|
||||
end;
|
||||
@ -412,13 +412,8 @@ var
|
||||
begin
|
||||
for c in AnsiChar do
|
||||
LCaseArray[c]:=AnsiLowerCase(c)[1];
|
||||
{$if declared(InterlockedExchange)}
|
||||
InterlockedExchange(LCaseArrayPrepared, 1);
|
||||
{$elseif not defined(fpc_has_feature_threading)}
|
||||
LCaseArrayPrepared := 1;
|
||||
{$else}
|
||||
{$error Either InterlockedExchange must be available or threading must not be present.}
|
||||
{$endif}
|
||||
WriteBarrier; // Write LCaseArrayPrepared only after LCaseArray contents.
|
||||
LCaseArrayPrepared:=true;
|
||||
end;
|
||||
|
||||
(*
|
||||
@ -486,8 +481,9 @@ begin
|
||||
Exit(False);
|
||||
|
||||
//Build an internal array of lowercase version of every possible AnsiChar.
|
||||
if bm.LCaseArrayPrepared=0 then
|
||||
if not bm.LCaseArrayPrepared then
|
||||
bm.PrepareLCaseArray;
|
||||
ReadBarrier; // Read LCaseArray contents only after LCaseArrayPrepared.
|
||||
|
||||
//Create the new lowercased pattern. Or avoid and reuse OldPattern if nothing to lowercase!
|
||||
lPattern:=OldPattern;
|
||||
|
Loading…
Reference in New Issue
Block a user