/* Returns: the data of the first element in the queue, or NULL if the queue is empty  */
gpointer g_queue_pop_head(GQueue *queue)
/* Returns: the data of the first element in the queue, or NULL if the queue is empty  */
gpointer g_queue_pop_head(GQueue *queue)
{
  g_return_val_if_fail (queue != NULL, NULL);
  if (queue->head)
    {
      GList *node = queue->head;
      gpointer data = node->data;
      queue->head = node->next;
      if (queue->head)
        queue->head->prev = NULL;
      else
        queue->tail = NULL;
      g_list_free_1 (node);
      queue->length--;
      return data;
    }
  return NULL;
}