diff libiberty/fibheap.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children 04ced10e8804
line wrap: on
line diff
--- a/libiberty/fibheap.c	Sun Feb 07 18:28:00 2010 +0900
+++ b/libiberty/fibheap.c	Fri Feb 12 23:39:51 2010 +0900
@@ -214,7 +214,10 @@
   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 @@
 
   /* 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;