mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 15:17:13 +08:00
merge from gcc
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2001-08-22 Matt Kraai <kraai@alumni.carnegiemellon.edu>
|
||||||
|
|
||||||
|
* fibheap.c (fibheap_init, fibnode_init): Remove.
|
||||||
|
(fibheap_new, fibnode_new): Use xcalloc to allocate and
|
||||||
|
initialize memory.
|
||||||
|
(fibheap_insert): Remove check for node allocation failure.
|
||||||
|
|
||||||
2001-08-21 Richard Henderson <rth@redhat.com>
|
2001-08-21 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* Makefile.in (fibheap.o): Depend on config.h.
|
* Makefile.in (fibheap.o): Depend on config.h.
|
||||||
|
@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA. */
|
|||||||
|
|
||||||
#define FIBHEAPKEY_MIN LONG_MIN
|
#define FIBHEAPKEY_MIN LONG_MIN
|
||||||
|
|
||||||
static void fibheap_init PARAMS ((fibheap_t));
|
|
||||||
static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
|
static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
|
||||||
static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
|
static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
|
||||||
static void fibheap_consolidate PARAMS ((fibheap_t));
|
static void fibheap_consolidate PARAMS ((fibheap_t));
|
||||||
@ -49,62 +48,29 @@ static int fibheap_compare PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
|||||||
static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
|
static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
|
||||||
fibnode_t));
|
fibnode_t));
|
||||||
static fibnode_t fibnode_new PARAMS ((void));
|
static fibnode_t fibnode_new PARAMS ((void));
|
||||||
static void fibnode_init PARAMS ((fibnode_t));
|
|
||||||
static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
|
static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
|
||||||
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
|
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
|
||||||
static fibnode_t fibnode_remove PARAMS ((fibnode_t));
|
static fibnode_t fibnode_remove PARAMS ((fibnode_t));
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the passed in fibonacci heap. */
|
|
||||||
static inline void
|
|
||||||
fibheap_init (heap)
|
|
||||||
fibheap_t heap;
|
|
||||||
{
|
|
||||||
heap->nodes = 0;
|
|
||||||
heap->min = NULL;
|
|
||||||
heap->root = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a new fibonacci heap. */
|
/* Create a new fibonacci heap. */
|
||||||
fibheap_t
|
fibheap_t
|
||||||
fibheap_new ()
|
fibheap_new ()
|
||||||
{
|
{
|
||||||
fibheap_t result;
|
return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
|
||||||
|
|
||||||
if ((result = xmalloc (sizeof (*result))) == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
fibheap_init (result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the passed in fibonacci heap node. */
|
|
||||||
static inline void
|
|
||||||
fibnode_init (node)
|
|
||||||
fibnode_t node;
|
|
||||||
{
|
|
||||||
node->degree = 0;
|
|
||||||
node->mark = 0;
|
|
||||||
node->parent = NULL;
|
|
||||||
node->child = NULL;
|
|
||||||
node->left = node;
|
|
||||||
node->right = node;
|
|
||||||
node->data = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new fibonacci heap node. */
|
/* Create a new fibonacci heap node. */
|
||||||
static inline fibnode_t
|
static fibnode_t
|
||||||
fibnode_new ()
|
fibnode_new ()
|
||||||
{
|
{
|
||||||
fibnode_t e;
|
fibnode_t node;
|
||||||
|
|
||||||
if ((e = xmalloc (sizeof *e)) == NULL)
|
node = xcalloc (1, sizeof *node);
|
||||||
return NULL;
|
node->left = node;
|
||||||
|
node->right = node;
|
||||||
|
|
||||||
fibnode_init (e);
|
return node;
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
@ -144,9 +110,8 @@ fibheap_insert (heap, key, data)
|
|||||||
{
|
{
|
||||||
fibnode_t node;
|
fibnode_t node;
|
||||||
|
|
||||||
/* Create the new node, if we fail, return NULL. */
|
/* Create the new node. */
|
||||||
if ((node = fibnode_new ()) == NULL)
|
node = fibnode_new ();
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Set the node's data. */
|
/* Set the node's data. */
|
||||||
node->data = data;
|
node->data = data;
|
||||||
|
Reference in New Issue
Block a user