! * \brief lqueueRemove() * * \param[in] lq 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. * */
| 251 | * </pre> |
| 252 | */ |
| 253 | void * |
| 254 | lqueueRemove(L_QUEUE *lq) |
| 255 | { |
| 256 | void *item; |
| 257 | |
| 258 | PROCNAME("lqueueRemove"); |
| 259 | |
| 260 | if (!lq) |
| 261 | return (void *)ERROR_PTR("lq not defined", procName, NULL); |
| 262 | |
| 263 | if (lq->nelem == 0) |
| 264 | return NULL; |
| 265 | item = lq->array[lq->nhead]; |
| 266 | lq->array[lq->nhead] = NULL; |
| 267 | if (lq->nelem == 1) |
| 268 | lq->nhead = 0; /* reset head ptr */ |
| 269 | else |
| 270 | (lq->nhead)++; /* can't go off end of array because nelem > 1 */ |
| 271 | lq->nelem--; |
| 272 | return item; |
| 273 | } |
| 274 | |
| 275 | |
| 276 | /*! |
no outgoing calls
no test coverage detected