Lines Matching refs:fifo
42 struct util_fifo *fifo; in u_fifo_create() local
43 fifo = MALLOC(sizeof(*fifo) + size * sizeof(void*)); in u_fifo_create()
45 fifo->head = 0; in u_fifo_create()
46 fifo->tail = 0; in u_fifo_create()
47 fifo->num = 0; in u_fifo_create()
48 fifo->size = size; in u_fifo_create()
50 return fifo; in u_fifo_create()
54 u_fifo_add(struct util_fifo *fifo, void *ptr) in u_fifo_add() argument
56 void **array = (void**)&fifo[1]; in u_fifo_add()
57 if (fifo->num >= fifo->size) in u_fifo_add()
60 if (++fifo->head >= fifo->size) in u_fifo_add()
61 fifo->head = 0; in u_fifo_add()
63 array[fifo->head] = ptr; in u_fifo_add()
65 ++fifo->num; in u_fifo_add()
71 u_fifo_pop(struct util_fifo *fifo, void **ptr) in u_fifo_pop() argument
73 void **array = (void**)&fifo[1]; in u_fifo_pop()
75 if (!fifo->num) in u_fifo_pop()
78 if (++fifo->tail >= fifo->size) in u_fifo_pop()
79 fifo->tail = 0; in u_fifo_pop()
81 *ptr = array[fifo->tail]; in u_fifo_pop()
83 ++fifo->num; in u_fifo_pop()
89 u_fifo_destroy(struct util_fifo *fifo) in u_fifo_destroy() argument
91 FREE(fifo); in u_fifo_destroy()