void * list_pop_value(linked_list_t *list) { void *val = NULL; list_entry_t *entry = pop_entry(list); if(entry) { val = entry->value; destroy_entry(entry); } return val; }
/* Retreive the list_entry_t at pos in a linked_list_t removing it from the list * XXX - no locking here because this routine is just an accessor to other routines * Caller MUST destroy the returned entry trough destroy_entry() call */ static inline list_entry_t *fetch_entry(linked_list_t *list, size_t pos) { list_entry_t *entry = NULL; if(pos == 0 ) return shift_entry(list); else if(pos == list_count(list) - 1) return pop_entry(list); entry = remove_entry(list, pos); return entry; }
void * Parrot_do_handle_events(Parrot_Interp interpreter, int restore, void *next) { QUEUE_ENTRY *entry; parrot_event* event; QUEUE * tq = interpreter->task_queue; if (restore) disable_event_checking(interpreter); if (!peek_entry(tq)) return next; while (peek_entry(tq)) { entry = pop_entry(tq); event = (parrot_event* )entry->data; mem_sys_free(entry); next = do_event(interpreter, event, next); } return next; }
bool Intersection (INTERSECTION *Ray_Intersection, OBJECT *Object, RAY *Ray) { ISTACK *Depth_Stack; INTERSECTION *Local; DBL Closest = HUGE_VAL; if (Object == NULL) { return (false); } if (!Ray_In_Bound (Ray,Object->Bound)) { return (false); } Depth_Stack = open_istack (); if (All_Intersections (Object, Ray, Depth_Stack)) { while ((Local = pop_entry(Depth_Stack)) != NULL) { if (Local->Depth < Closest) { *Ray_Intersection = *Local; Closest = Local->Depth; } } close_istack (Depth_Stack); return (true); } else { close_istack (Depth_Stack); return (false); } }