Reformatted the source somewhat and removed preproccessor #include statements to the respective header files since those are only needed externally

This commit is contained in:
tedbullock 2007-09-18 04:48:11 +00:00
vanhempi 86d75c8bed
commit f23333a597
2 muutettua tiedostoa jossa 12 lisäystä ja 12 poistoa

Näytä tiedosto

@ -34,19 +34,18 @@
#include <stdbool.h>
#include <generic_types.h>
#include <heap.h>
#define Minimum_Heap_Size 10
struct Heap {
u_long array_size;
u_long num_elements;
heap_compare compare;
_Bool (*compare)(Any_Type, Any_Type);
Any_Type storage[]; /* c99 Flexible Array Member */
};
struct Heap *
create_heap(u_long size, heap_compare compare_callback)
create_heap(u_long size, _Bool (*compare_callback) (Any_Type, Any_Type))
{
struct Heap *h;
@ -158,7 +157,7 @@ poll_min(struct Heap * h)
}
void
heap_for_each(struct Heap *h, heap_for_each_action action)
heap_for_each(struct Heap *h, void (*action) (Any_Type))
{
for(u_long i = 1; i <= h->num_elements; i++)
{

Näytä tiedosto

@ -46,7 +46,6 @@
#define WHEEL_SIZE 4096
#define TIMER_INTERVAL (1.0/1000) /* timer granularity in seconds */
typedef void (*Timer_Callback) (struct Timer * t, Any_Type arg);
static Time now;
static Time next_tick;
@ -57,7 +56,7 @@ struct Timer {
/*
* Callback function called when timer expires (timeout)
*/
Timer_Callback timeout_callback;
void (*timeout_callback) (struct Timer * t, Any_Type arg);
/*
* Typically used as a void pointer to the data object being timed
@ -145,9 +144,9 @@ timer_init(void)
goto init_failure;
while (!is_queue_full(passive_timers)) {
Any_Type a;
Any_Type a;
a.vp = malloc(sizeof(struct Timer));
if (a.vp == NULL)
goto init_failure;
@ -191,7 +190,7 @@ static void
expire_complete_timers(Any_Type a)
{
struct Timer *t = (struct Timer *) a.vp;
if (t->delta == 0) {
(*t->timeout_callback) (t, t->timer_subject);
@ -248,7 +247,8 @@ timer_tick(void)
}
struct Timer *
timer_schedule(Timer_Callback timeout, Any_Type subject, Time delay)
timer_schedule(void (*timeout) (struct Timer * t, Any_Type arg),
Any_Type subject, Time delay)
{
struct Timer *t;
u_long ticks;
@ -284,8 +284,9 @@ timer_schedule(Timer_Callback timeout, Any_Type subject, Time delay)
insert((Any_Type) (void *) t, active_timers);
if (DBG > 2)
fprintf(stderr, "timer_schedule: t=%p, delay=%gs, subject=%lx\n",
t, delay, subject.l);
fprintf(stderr,
"timer_schedule: t=%p, delay=%gs, subject=%lx\n", t,
delay, subject.l);
return t;
}