static void fd_ring_clear (I_ring *fd_ring) { while ( ! i_ring_empty (fd_ring)) { int fd = i_ring_pop (fd_ring); if (0 <= fd) close (fd); } }
int i_ring_pop (I_ring *ir) { int top_val; if (i_ring_empty (ir)) abort (); top_val = ir->ir_data[ir->ir_front]; ir->ir_data[ir->ir_front] = ir->ir_default_val; if (ir->ir_front == ir->ir_back) ir->ir_empty = true; else ir->ir_front = ((ir->ir_front + I_RING_SIZE - 1) % I_RING_SIZE); return top_val; }