Changeset 47be512 in mainline


Ignore:
Timestamp:
2018-06-19T19:42:48Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9f272d9
Parents:
75c430e3
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-01 15:07:20)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-19 19:42:48)
Message:

Introduce list_pop().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/list.h

    r75c430e3 r47be512  
    414414}
    415415
     416static inline void *list_pop_internal(list_t *list, ptrdiff_t offset)
     417{
     418        link_t *tmp = list_first(list);
     419        if (tmp == NULL)
     420                return NULL;
     421
     422        list_remove(tmp);
     423        return ((void *) tmp) - offset;
     424}
     425
     426#define list_pop(list, type, member) \
     427        ((type *) list_pop_internal(list, \
     428            (list_link_to_void(&(((type *) NULL)->member)) - NULL)))
     429
    416430#endif
    417431
Note: See TracChangeset for help on using the changeset viewer.