Changed _Bool to bool

This commit is contained in:
tedbullock 2007-09-25 02:02:45 +00:00
parent c5e7d8b6c3
commit 9368c8cbd4
2 changed files with 17 additions and 19 deletions

View File

@ -31,7 +31,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdbool.h>
#include <generic_types.h>
@ -40,12 +39,12 @@
struct Heap {
u_long array_size;
u_long num_elements;
_Bool (*compare)(Any_Type, Any_Type);
bool (*compare) (Any_Type, Any_Type);
Any_Type storage[]; /* c99 Flexible Array Member */
};
struct Heap *
create_heap(u_long size, _Bool (*compare_callback) (Any_Type, Any_Type))
create_heap(u_long size, bool(*compare_callback) (Any_Type, Any_Type))
{
struct Heap *h;
@ -66,13 +65,13 @@ create_heap(u_long size, _Bool (*compare_callback) (Any_Type, Any_Type))
return h;
}
_Bool
bool
is_heap_empty(struct Heap * h)
{
return h->num_elements == 0;
}
_Bool
bool
is_heap_full(struct Heap * h)
{
return h->array_size == h->num_elements;
@ -92,7 +91,7 @@ free_heap(struct Heap *h)
}
#define PARENT(i) (i/2)
_Bool
bool
insert(Any_Type a, struct Heap *h)
{
u_long i, parent;
@ -159,8 +158,7 @@ poll_min(struct Heap * h)
void
heap_for_each(struct Heap *h, void (*action) (Any_Type))
{
for(u_long i = 1; i <= h->num_elements; i++)
{
for (u_long i = 1; i <= h->num_elements; i++) {
(*action) (h->storage[i]);
}
}

View File

@ -33,16 +33,16 @@
struct Heap;
typedef _Bool (*heap_compare) (Any_Type, Any_Type);
typedef bool(*heap_compare) (Any_Type, Any_Type);
typedef void (*heap_for_each_action) (Any_Type);
struct Heap *create_heap(u_long, heap_compare);
_Bool is_heap_empty(struct Heap *);
_Bool is_heap_full(struct Heap *);
bool is_heap_empty(struct Heap *);
bool is_heap_full(struct Heap *);
u_long num_heap_elements(struct Heap *);
void free_heap(struct Heap *);
_Bool insert(Any_Type, struct Heap *);
bool insert(Any_Type, struct Heap *);
Any_Type remove_min(struct Heap *);
Any_Type poll_min(struct Heap *);