queue.c
/*
 * Return number of elements in queue.
 * Return 0 if q is NULL or empty
 */
Return number of elements in queue.
Return 0 if q is NULL or empty
Return number of elements in queue . Return 0 if q is NULL or empty
int q_size(struct list_head *head)
{
    if (!head || head->next == head)
        return 0;
    int count = 0;
    struct list_head *node;
    list_for_each (node, head) {
        count++;
    }
    return count;
}
int q_size ( struct list_head * head ) { if ( ! head || head -> next == head ) return 0 ; int count = 0 ; struct list_head * node ; list_for_each ( node , head ) { count ++ ; } return count ; }
Return number of elements in queue.
Return number of elements in queue .