Code cleanup.
Add some comments and align lines.
1.1 --- a/src/ahven-slist.adb Mon Jun 15 23:02:54 2009 +0300
1.2 +++ b/src/ahven-slist.adb Mon Jun 15 23:16:04 2009 +0300
1.3 @@ -40,6 +40,8 @@
1.4 Target.Last := New_Node;
1.5 end if;
1.6
1.7 + -- XXX To be 100% correct, one should check that
1.8 + -- Target.Size does not overflow.
1.9 Target.Size := Target.Size + 1;
1.10 end Append;
1.11
1.12 @@ -103,11 +105,12 @@
1.13 end Finalize;
1.14
1.15 procedure Adjust (Target : in out List) is
1.16 - Target_Last : Node_Access := null;
1.17 + Target_Last : Node_Access := null;
1.18 Target_First : Node_Access := null;
1.19 - Current : Node_Access := Target.First;
1.20 - New_Node : Node_Access;
1.21 + Current : Node_Access := Target.First;
1.22 + New_Node : Node_Access;
1.23 begin
1.24 + -- Recreate the list using the same data
1.25 while Current /= null loop
1.26 New_Node := new Node'(Data => Current.Data, Next => null);
1.27
1.28 @@ -123,5 +126,7 @@
1.29 end loop;
1.30 Target.First := Target_First;
1.31 Target.Last := Target_Last;
1.32 +
1.33 + -- No need to adjust size, it is same as before copying
1.34 end Adjust;
1.35 end Ahven.SList;