comparison 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
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
212 okey = node->key; 212 okey = node->key;
213 node->data = data; 213 node->data = data;
214 node->key = key; 214 node->key = key;
215 y = node->parent; 215 y = node->parent;
216 216
217 if (okey == key) 217 /* Short-circuit if the key is the same, as we then don't have to
218 do anything. Except if we're trying to force the new node to
219 be the new minimum for delete. */
220 if (okey == key && okey != FIBHEAPKEY_MIN)
218 return odata; 221 return odata;
219 222
220 /* These two compares are specifically <= 0 to make sure that in the case 223 /* These two compares are specifically <= 0 to make sure that in the case
221 of equality, a node we replaced the data on, becomes the new min. This 224 of equality, a node we replaced the data on, becomes the new min. This
222 is needed so that delete's call to extractmin gets the right node. */ 225 is needed so that delete's call to extractmin gets the right node. */
254 { 257 {
255 void *ret = node->data; 258 void *ret = node->data;
256 259
257 /* To perform delete, we just make it the min key, and extract. */ 260 /* To perform delete, we just make it the min key, and extract. */
258 fibheap_replace_key (heap, node, FIBHEAPKEY_MIN); 261 fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
262 if (node != heap->min)
263 {
264 fprintf (stderr, "Can't force minimum on fibheap.\n");
265 abort ();
266 }
259 fibheap_extract_min (heap); 267 fibheap_extract_min (heap);
260 268
261 return ret; 269 return ret;
262 } 270 }
263 271