Recent

Author Topic: LazUtils LazLinkedList, result of ConsistencyCheck  (Read 558 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 1766
    • UVviewsoft
LazUtils LazLinkedList, result of ConsistencyCheck
« on: January 26, 2022, 10:09:27 pm »
The result is actually enum, because it's one of: 0, -1, -2, -3, -4.
Code: Pascal  [Select][+][-]
  1.   if FFreeCount<>RealCount then begin
  2.     Result:=-1;  exit;
  3.   end;
  4.   // test items
  5.   RealCount:=0;
  6.   AnItem:=FFirst;
  7.   while AnItem<>nil do begin
  8.     if (AnItem.Next<>nil) and (AnItem.Next.Prior<>AnItem) then begin
  9.       Result:=-2;  exit;
  10.     end;
  11.     if (AnItem.Prior<>nil) and (AnItem.Prior.Next<>AnItem) then begin
  12.       Result:=-3;  exit;
  13.     end;
  14.     inc(RealCount);
  15.     AnItem:=AnItem.Next;
  16.   end;
  17.   if FCount<>RealCount then begin
  18.     Result:=-4;  exit;
  19.   end;
  20.   Result:=0;
  21. end;                    
  22.  
Let's make it normal enum?
« Last Edit: January 26, 2022, 10:11:59 pm by Alextp »

 

TinyPortal © 2005-2018