~ubuntu-branches/ubuntu/precise/libdrm/precise-proposed

« back to all changes in this revision

Viewing changes to libdrm_lists.h

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2013-01-18 16:30:10 UTC
  • mfrom: (2.1.68 quantal)
  • Revision ID: package-import@ubuntu.com-20130118163010-9vigrb0l2x93dujm
Tags: 2.4.39-0ubuntu0.1
Copy libdrm from quantal. (LP: #1086345)

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
#define DRMLISTEMPTY(__item) ((__item)->next == (__item))
80
80
 
 
81
#define DRMLISTSINGLE(__list) \
 
82
        (!DRMLISTEMPTY(__list) && ((__list)->next == (__list)->prev))
 
83
 
 
84
#define DRMLISTFOREACH(__item, __list)                                  \
 
85
        for ((__item) = (__list)->next;                                 \
 
86
             (__item) != (__list); (__item) = (__item)->next)
 
87
 
81
88
#define DRMLISTFOREACHSAFE(__item, __temp, __list)                      \
82
89
        for ((__item) = (__list)->next, (__temp) = (__item)->next;      \
83
90
             (__item) != (__list);                                      \
87
94
        for ((__item) = (__list)->prev, (__temp) = (__item)->prev;      \
88
95
             (__item) != (__list);                                      \
89
96
             (__item) = (__temp), (__temp) = (__item)->prev)
 
97
 
 
98
#define DRMLISTFOREACHENTRY(__item, __list, __head)                            \
 
99
        for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head); \
 
100
             &(__item)->__head != (__list);                                    \
 
101
             (__item) = DRMLISTENTRY(typeof(*__item),                          \
 
102
                                     (__item)->__head.next, __head))
 
103
 
 
104
#define DRMLISTFOREACHENTRYSAFE(__item, __temp, __list, __head)                \
 
105
        for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head), \
 
106
             (__temp) = DRMLISTENTRY(typeof(*__item),                          \
 
107
                                     (__item)->__head.next, __head);           \
 
108
             &(__item)->__head != (__list);                                    \
 
109
             (__item) = (__temp),                                              \
 
110
             (__temp) = DRMLISTENTRY(typeof(*__item),                          \
 
111
                                     (__temp)->__head.next, __head))
 
112
 
 
113
#define DRMLISTJOIN(__list, __join) if (!DRMLISTEMPTY(__list)) {        \
 
114
        (__list)->next->prev = (__join);                                \
 
115
        (__list)->prev->next = (__join)->next;                          \
 
116
        (__join)->next->prev = (__list)->prev;                          \
 
117
        (__join)->next = (__list)->next;                                \
 
118
}