src/queue.c
void *
lqueueRemove(L_QUEUE  *lq)
{
void  *item;

    PROCNAME("lqueueRemove");

    if (!lq)
        return (void *)ERROR_PTR("lq not defined", procName, NULL);

    if (lq->nelem == 0)
        return NULL;
    item = lq->array[lq->nhead];
    lq->array[lq->nhead] = NULL;
    if (lq->nelem == 1) 
        lq->nhead = 0;  /* reset head ptr */
    else
        (lq->nhead)++;  /* can't go off end of array because nelem > 1 */
    lq->nelem--;
    return item;
}
/*!
 *  lqueueRemove()
 *
 *      Input:  lqueue
 *      Return: ptr to item popped from the head of the queue,
 *              or null if the queue is empty or on error
 *
 *  Notes:
 *      (1) If this is the last item on the queue, so that the queue
 *          becomes empty, nhead is reset to the beginning of the array.
 */
lqueueRemove()
Input:  lqueue
Return: ptr to item popped from the head of the queue,
or null if the queue is empty or on error

(1) If this is the last item on the queue, so that the queue
becomes empty, nhead is reset to the beginning of the array.
lqueueRemove () Input : lqueue Return : ptr to item popped from the head of the queue or null if the queue is empty or on error ( 1 ) If this is the last item on the queue so that the queue becomes empty nhead is reset to the beginning of the array .
void *
lqueueRemove(L_QUEUE  *lq)
{
void  *item;
    PROCNAME("lqueueRemove");
    if (!lq)
        return (void *)ERROR_PTR("lq not defined", procName, NULL);
    if (lq->nelem == 0)
        return NULL;
    item = lq->array[lq->nhead];
    lq->array[lq->nhead] = NULL;
    if (lq->nelem == 1) 
        lq->nhead = 0;  
    else
        (lq->nhead)++;  
    lq->nelem--;
    return item;
}
void * lqueueRemove ( L_QUEUE * lq ) { void * item ; PROCNAME ( " " ) ; if ( ! lq ) return ( void * ) ERROR_PTR ( " " , procName , NULL ) ; if ( lq -> nelem == 0 ) return NULL ; item = lq -> array [ lq -> nhead ] ; lq -> array [ lq -> nhead ] = NULL ; if ( lq -> nelem == 1 ) lq -> nhead = 0 ; else ( lq -> nhead ) ++ ; lq -> nelem -- ; return item ; }
lqueueRemove()
      Input:  lqueue
      Return: ptr to item popped from the head of the queue,
              or null if the queue is empty or on error
lqueueRemove () Input : lqueue Return : ptr to item popped from the head of the queue or null if the queue is empty or on error
/* reset head ptr */ /* can't go off end of array because nelem > 1 */