diff options
author | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-07 00:28:29 +0000 |
---|---|---|
committer | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-07 00:28:29 +0000 |
commit | 94bf16b473961746c91c208bf13079aebac78b54 (patch) | |
tree | 887edab011cbaf9750f46bb7b5ed7530bb712341 /gcc/fortran/bbt.c | |
parent | 91428312f632d5e9c327d417d41a493b0918dd34 (diff) | |
download | gcc-94bf16b473961746c91c208bf13079aebac78b54.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120542 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/bbt.c')
-rw-r--r-- | gcc/fortran/bbt.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/fortran/bbt.c b/gcc/fortran/bbt.c index ce1f24eca24..6cee4743c89 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); } |