|
|
@ -185,7 +185,7 @@ void EVTqueue_inst( |
|
|
Evt_Inst_Event_t *new_event; |
|
|
Evt_Inst_Event_t *new_event; |
|
|
Evt_Inst_Event_t *next; |
|
|
Evt_Inst_Event_t *next; |
|
|
|
|
|
|
|
|
Mif_Boolean_t splice, malloced = FALSE; |
|
|
|
|
|
|
|
|
Mif_Boolean_t splice; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get pointers for fast access */ |
|
|
/* Get pointers for fast access */ |
|
|
@ -196,26 +196,12 @@ void EVTqueue_inst( |
|
|
(event_time < inst_queue->next_time)) |
|
|
(event_time < inst_queue->next_time)) |
|
|
inst_queue->next_time = event_time; |
|
|
inst_queue->next_time = event_time; |
|
|
|
|
|
|
|
|
/* Create a new event or get one from the free list and copy in data */ |
|
|
|
|
|
if(inst_queue->free[inst_index]) { |
|
|
|
|
|
new_event = inst_queue->free[inst_index]; |
|
|
|
|
|
inst_queue->free[inst_index] = new_event->next; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
new_event = TMALLOC(Evt_Inst_Event_t, 1); |
|
|
|
|
|
malloced = TRUE; |
|
|
|
|
|
} |
|
|
|
|
|
new_event->event_time = event_time; |
|
|
|
|
|
new_event->posted_time = posted_time; |
|
|
|
|
|
|
|
|
|
|
|
/* Find location at which to insert event */ |
|
|
/* Find location at which to insert event */ |
|
|
splice = MIF_FALSE; |
|
|
splice = MIF_FALSE; |
|
|
here = inst_queue->current[inst_index]; |
|
|
here = inst_queue->current[inst_index]; |
|
|
while(*here) { |
|
|
while(*here) { |
|
|
/* If there's an event with the same time, don't duplicate it */ |
|
|
/* If there's an event with the same time, don't duplicate it */ |
|
|
if(event_time == (*here)->event_time) { |
|
|
if(event_time == (*here)->event_time) { |
|
|
if(malloced) |
|
|
|
|
|
tfree(new_event); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
else if(event_time < (*here)->event_time) { |
|
|
else if(event_time < (*here)->event_time) { |
|
|
@ -225,6 +211,17 @@ void EVTqueue_inst( |
|
|
here = &((*here)->next); |
|
|
here = &((*here)->next); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Create a new event or get one from the free list and copy in data */ |
|
|
|
|
|
if(inst_queue->free[inst_index]) { |
|
|
|
|
|
new_event = inst_queue->free[inst_index]; |
|
|
|
|
|
inst_queue->free[inst_index] = new_event->next; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
new_event = TMALLOC(Evt_Inst_Event_t, 1); |
|
|
|
|
|
} |
|
|
|
|
|
new_event->event_time = event_time; |
|
|
|
|
|
new_event->posted_time = posted_time; |
|
|
|
|
|
|
|
|
/* If needs to be spliced into middle of existing list */ |
|
|
/* If needs to be spliced into middle of existing list */ |
|
|
if(splice) { |
|
|
if(splice) { |
|
|
/* splice it in */ |
|
|
/* splice it in */ |
|
|
|