aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2014-07-30 09:59:29 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-30 11:59:29 +0200
commitec62224622de6d29ea9ed09426967d1bf8ceea42 (patch)
treea6e9010e4418e465cfed70708babf5c9ae6c899f /gcc
parent47166578371bda0dc9681902638ec1ae822cd83c (diff)
downloadgcc-ec62224622de6d29ea9ed09426967d1bf8ceea42.zip
gcc-ec62224622de6d29ea9ed09426967d1bf8ceea42.tar.gz
gcc-ec62224622de6d29ea9ed09426967d1bf8ceea42.tar.bz2
a-cbmutr.adb (Insert_Child): Use local variable First to keep track of the initial element's index within...
2014-07-30 Hristian Kirtchev <kirtchev@adacore.com> * a-cbmutr.adb (Insert_Child): Use local variable First to keep track of the initial element's index within the tree. From-SVN: r213235
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/a-cbmutr.adb20
2 files changed, 15 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 14891b7..c3d1b62 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-30 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * a-cbmutr.adb (Insert_Child): Use local variable First to keep
+ track of the initial element's index within the tree.
+
2014-07-29 Hristian Kirtchev <kirtchev@adacore.com>
* a-cbmutr.adb (Allocate_Node): Remove the two parameter version.
diff --git a/gcc/ada/a-cbmutr.adb b/gcc/ada/a-cbmutr.adb
index c812003..1745528 100644
--- a/gcc/ada/a-cbmutr.adb
+++ b/gcc/ada/a-cbmutr.adb
@@ -1498,6 +1498,7 @@ package body Ada.Containers.Bounded_Multiway_Trees is
Count : Count_Type := 1)
is
Nodes : Tree_Node_Array renames Container.Nodes;
+ First : Count_Type;
Last : Count_Type;
begin
@@ -1538,10 +1539,10 @@ package body Ada.Containers.Bounded_Multiway_Trees is
Initialize_Root (Container);
end if;
- Allocate_Node (Container, New_Item, Position.Node);
- Nodes (Position.Node).Parent := Parent.Node;
+ Allocate_Node (Container, New_Item, First);
+ Nodes (First).Parent := Parent.Node;
- Last := Position.Node;
+ Last := First;
for J in Count_Type'(2) .. Count loop
Allocate_Node (Container, New_Item, Nodes (Last).Next);
Nodes (Nodes (Last).Next).Parent := Parent.Node;
@@ -1552,14 +1553,14 @@ package body Ada.Containers.Bounded_Multiway_Trees is
Insert_Subtree_List
(Container => Container,
- First => Position.Node,
+ First => First,
Last => Last,
Parent => Parent.Node,
Before => Before.Node);
Container.Count := Container.Count + Count;
- Position.Container := Parent.Container;
+ Position := Cursor'(Parent.Container, First);
end Insert_Child;
procedure Insert_Child
@@ -1621,11 +1622,10 @@ package body Ada.Containers.Bounded_Multiway_Trees is
-- initialization, so insert the specified number of possibly
-- initialized elements at the given position.
- Allocate_Node (Container, New_Item, Position.Node);
- First := Position.Node;
- Nodes (Position.Node).Parent := Parent.Node;
+ Allocate_Node (Container, New_Item, First);
+ Nodes (First).Parent := Parent.Node;
- Last := Position.Node;
+ Last := First;
for J in Count_Type'(2) .. Count loop
Allocate_Node (Container, New_Item, Nodes (Last).Next);
Nodes (Nodes (Last).Next).Parent := Parent.Node;
@@ -1636,7 +1636,7 @@ package body Ada.Containers.Bounded_Multiway_Trees is
Insert_Subtree_List
(Container => Container,
- First => Position.Node,
+ First => First,
Last => Last,
Parent => Parent.Node,
Before => Before.Node);