aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/bbt.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2007-01-07 00:28:29 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2007-01-07 00:28:29 +0000
commit65f8144a803cef2fbd7f73334603318547f4df0b (patch)
tree887edab011cbaf9750f46bb7b5ed7530bb712341 /gcc/fortran/bbt.c
parentae82248d4595b4d7dcd7272844233b0768ee609f (diff)
downloadgcc-65f8144a803cef2fbd7f73334603318547f4df0b.zip
gcc-65f8144a803cef2fbd7f73334603318547f4df0b.tar.gz
gcc-65f8144a803cef2fbd7f73334603318547f4df0b.tar.bz2
[multiple changes]
2007-01-06 Steven G. Kargl <kargl@gcc.gnu.org> * array.c, bbt.c, check.c: Update copyright years. Whitespace. 2006-01-06 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/present_1.f90: Update error message. From-SVN: r120542
Diffstat (limited to 'gcc/fortran/bbt.c')
-rw-r--r--gcc/fortran/bbt.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/fortran/bbt.c b/gcc/fortran/bbt.c
index ce1f24e..6cee474 100644
--- a/gcc/fortran/bbt.c
+++ b/gcc/fortran/bbt.c
@@ -1,5 +1,6 @@
/* Balanced binary trees using treaps.
- Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2003, 2007
+ Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of GCC.
@@ -62,7 +63,7 @@ pseudo_random (void)
/* Rotate the treap left. */
static gfc_bbt *
-rotate_left (gfc_bbt * t)
+rotate_left (gfc_bbt *t)
{
gfc_bbt *temp;
@@ -77,7 +78,7 @@ rotate_left (gfc_bbt * t)
/* Rotate the treap right. */
static gfc_bbt *
-rotate_right (gfc_bbt * t)
+rotate_right (gfc_bbt *t)
{
gfc_bbt *temp;
@@ -93,7 +94,7 @@ rotate_right (gfc_bbt * t)
aborts if we find a duplicate key. */
static gfc_bbt *
-insert (gfc_bbt * new, gfc_bbt * t, compare_fn compare)
+insert (gfc_bbt *new, gfc_bbt *t, compare_fn compare)
{
int c;
@@ -108,14 +109,12 @@ insert (gfc_bbt * new, gfc_bbt * t, compare_fn compare)
if (t->priority < t->left->priority)
t = rotate_right (t);
}
-
else if (c > 0)
{
t->right = insert (new, t->right, compare);
if (t->priority < t->right->priority)
t = rotate_left (t);
}
-
else /* if (c == 0) */
gfc_internal_error("insert_bbt(): Duplicate key found!");
@@ -134,13 +133,12 @@ gfc_insert_bbt (void *root, void *new, compare_fn compare)
r = (gfc_bbt **) root;
n = (gfc_bbt *) new;
-
n->priority = pseudo_random ();
*r = insert (n, *r, compare);
}
static gfc_bbt *
-delete_root (gfc_bbt * t)
+delete_root (gfc_bbt *t)
{
gfc_bbt *temp;
@@ -170,7 +168,7 @@ delete_root (gfc_bbt * t)
Returns the new root node of the tree. */
static gfc_bbt *
-delete_treap (gfc_bbt * old, gfc_bbt * t, compare_fn compare)
+delete_treap (gfc_bbt *old, gfc_bbt *t, compare_fn compare)
{
int c;
@@ -196,6 +194,5 @@ gfc_delete_bbt (void *root, void *old, compare_fn compare)
gfc_bbt **t;
t = (gfc_bbt **) root;
-
*t = delete_treap ((gfc_bbt *) old, *t, compare);
}