Changeset 00b7fc8 in mainline for uspace/lib/c/generic/adt/list.c


Ignore:
Timestamp:
2019-02-01T22:32:38Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Parents:
f959a20f
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 21:46:05)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 22:32:38)
Message:

wip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/list.c

    rf959a20f r00b7fc8  
    5555bool list_member(const link_t *link, const list_t *list)
    5656{
    57         bool found = false;
    58         link_t *hlp = list->head.next;
     57        if (list_empty(list))
     58                return false;
    5959
    60         while (hlp != &list->head) {
    61                 if (hlp == link) {
    62                         found = true;
    63                         break;
    64                 }
    65                 hlp = hlp->next;
     60        link_t *hlp = list->__adt_list_head.__adt_link_next;
     61
     62        while (hlp != &list->__adt_list_head) {
     63                if (hlp == link)
     64                        return true;
     65                hlp = hlp->__adt_link_next;
    6666        }
    6767
    68         return found;
     68        return false;
    6969}
    7070
     
    8383
    8484        /* Attach list to destination. */
    85         list->head.next->prev = pos;
    86         list->head.prev->next = pos->next;
     85        list->__adt_list_head.__adt_link_next->__adt_link_prev = pos;
     86        list->__adt_list_head.__adt_link_prev->__adt_link_next = pos->__adt_link_next;
    8787
    8888        /* Link destination list to the added list. */
    89         pos->next->prev = list->head.prev;
    90         pos->next = list->head.next;
     89        pos->__adt_link_next->__adt_link_prev = list->__adt_list_head.__adt_link_prev;
     90        pos->__adt_link_next = list->__adt_list_head.__adt_link_next;
    9191
    9292        list_initialize(list);
Note: See TracChangeset for help on using the changeset viewer.