diff options
author | DJ Delorie <dj@delorie.com> | 2009-05-29 03:01:15 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2009-05-29 03:01:15 +0000 |
commit | 854c8d0fdfa827ac9948116e6ddf6a02cec90fec (patch) | |
tree | b7a00d86b91daf9850ed2145cbbdbcdc8554ddbf /libiberty/fibheap.c | |
parent | 6e14d8a6b72929239efe37c4cbcb75e7a153b03b (diff) | |
download | binutils-redhat-854c8d0fdfa827ac9948116e6ddf6a02cec90fec.tar.gz |
merge from gcc
Diffstat (limited to 'libiberty/fibheap.c')
-rw-r--r-- | libiberty/fibheap.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c index c032149c0c..a37ee4ef27 100644 --- a/libiberty/fibheap.c +++ b/libiberty/fibheap.c @@ -214,7 +214,10 @@ fibheap_replace_key_data (fibheap_t heap, fibnode_t node, node->key = key; y = node->parent; - if (okey == key) + /* Short-circuit if the key is the same, as we then don't have to + do anything. Except if we're trying to force the new node to + be the new minimum for delete. */ + if (okey == key && okey != FIBHEAPKEY_MIN) return odata; /* These two compares are specifically <= 0 to make sure that in the case @@ -256,6 +259,11 @@ fibheap_delete_node (fibheap_t heap, fibnode_t node) /* To perform delete, we just make it the min key, and extract. */ fibheap_replace_key (heap, node, FIBHEAPKEY_MIN); + if (node != heap->min) + { + fprintf (stderr, "Can't force minimum on fibheap.\n"); + abort (); + } fibheap_extract_min (heap); return ret; |