Changeset 4c14b88 in mainline for kernel/generic/include/adt/list.h


Ignore:
Timestamp:
2013-12-31T07:57:14Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b973dc
Parents:
6297465 (diff), 208b5f5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/adt/list.h

    r6297465 r4c14b88  
    3737#define KERN_LIST_H_
    3838
     39#include <debug.h>
    3940#include <typedefs.h>
    4041#include <trace.h>
     
    7374            _link != &(list).head; _link = _link->next)
    7475
     76#define list_foreach_rev(list, member, itype, iterator) \
     77        for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \
     78            for (link_t *_link = (list).head.prev; \
     79            iterator = list_get_instance(_link, itype, member), \
     80            _link != &(list).head; _link = _link->prev)
     81
    7582#define assert_link_not_used(link) \
    76         ASSERT(((link)->prev == NULL) && ((link)->next == NULL))
     83        ASSERT(!link_used(link))
    7784
    7885/** Initialize doubly-linked circular list link
     
    319326}
    320327
     328/** Determine if link is used.
     329 *
     330 * @param link Link
     331 * @return @c true if link is used, @c false if not.
     332 */
     333static inline bool link_used(link_t *link)
     334{
     335        if (link->prev == NULL && link->next == NULL)
     336                return false;
     337
     338        ASSERT(link->prev != NULL && link->next != NULL);
     339        return true;
     340}
     341
    321342extern int list_member(const link_t *, const list_t *);
    322343extern void list_concat(list_t *, list_t *);
Note: See TracChangeset for help on using the changeset viewer.