Ejemplo n.º 1
0
EXPORT_C
#endif
void
_dbus_list_prepend_link (DBusList **list,
			 DBusList *link)
{
  link_before (list, *list, link);
}
Ejemplo n.º 2
0
/**
 * Inserts a link into the list before the given existing link.
 * 
 * @param list the list to modify
 * @param before_this_link existing link to insert before, or #NULL to append
 * @param link the link to insert
 */
void
_dbus_list_insert_before_link (DBusList **list,
                               DBusList  *before_this_link,
                               DBusList  *link)
{
  if (before_this_link == NULL)
    _dbus_list_append_link (list, link);
  else
    link_before (list, before_this_link, link);
}
Ejemplo n.º 3
0
Archivo: ehci.c Proyecto: MWDD/osdev
// ------------------------------------------------------------------------------------------------
static void ehci_insert_qh(EHCI_Controller* hc, EHCI_QH* qh)
{
    EHCI_QH* list = hc->async_qh;
    EHCI_QH* end = link_data(list->qh_link.prev, EHCI_QH, qh_link);

    qh->qhlp = (u32)(uintptr_t)list | PTR_QH;
    end->qhlp = (u32)(uintptr_t)qh | PTR_QH;

    link_before(&list->qh_link, &qh->qh_link);
}
 //! <b>Effects</b>: Moves the node p n positions towards the end of the list.
 //!
 //! <b>Throws</b>: Nothing.
 //!
 //! <b>Complexity</b>: Linear to the number of moved positions.
 static void move_backwards(const node_ptr &p, std::size_t n)
 {
    //Null shift, nothing to do
    if(!n) return;
    node_ptr first  = NodeTraits::get_next(p);
    //size() == 0 or 1, nothing to do
    if(first == NodeTraits::get_previous(p)) return;
    unlink(p);
    //Now get the new first node
    while(n--){
       first = NodeTraits::get_next(first);
    }
    link_before(first, p);
 }
Ejemplo n.º 5
0
/**
 * Prepends a value to the list. May return #FALSE
 * if insufficient memory exists to add a list link.
 * This is a constant-time operation.
 *
 * @param list address of the list head.
 * @param data the value to prepend.
 * @returns #TRUE on success.
 */
dbus_bool_t
_dbus_list_prepend (DBusList **list,
                    void      *data)
{
  DBusList *link;

  link = alloc_link (data);
  if (link == NULL)
    return FALSE;

  link_before (list, *list, link);

  return TRUE;
}
Ejemplo n.º 6
0
/**
 * Inserts data into the list before the given existing link.
 * 
 * @param list the list to modify
 * @param before_this_link existing link to insert before, or #NULL to append
 * @param data the value to insert
 * @returns #TRUE on success, #FALSE if memory allocation fails
 */
dbus_bool_t
_dbus_list_insert_before (DBusList **list,
                          DBusList  *before_this_link,
                          void      *data)
{
  DBusList *link;
  
  if (before_this_link == NULL)
    return _dbus_list_append (list, data);
  else
    {
      link = alloc_link (data);
      if (link == NULL)
        return FALSE;
  
      link_before (list, before_this_link, link);
    }
  
  return TRUE;
}
Ejemplo n.º 7
0
 void link_before(T* element, T* before) {
   link_before(&(element->*LinkMember), &(before->*LinkMember));
 }
Ejemplo n.º 8
0
 void link_tail(IntrusiveListLink<T>* link) {
   link_before(link, &sentinel_);
 }
Ejemplo n.º 9
0
 void link_after(IntrusiveListLink<T>* link, IntrusiveListLink<T>* before) {
   link_before(link, before->next);
 }