/* Returns: the #GList element at the tail of the queue, or NULL if the queue is empty  */
GList* g_queue_pop_tail_link(GQueue *queue)
/* Returns: the #GList element at the tail of the queue, or NULL if the queue is empty  */
GList* g_queue_pop_tail_link(GQueue *queue)
{
  g_return_val_if_fail (queue != NULL, NULL);
  if (queue->tail)
    {
      GList *node = queue->tail;
      queue->tail = node->prev;
      if (queue->tail)
        {
          queue->tail->next = NULL;
          node->prev = NULL;
        }
      else
        queue->head = NULL;
      queue->length--;
      return node;
    }
  return NULL;
}