Go to the source code of this file.
|
#define | OM_LIST_OFFSET(ptr, name_of_offset_field) |
|
#define | omListLength(ptr) |
|
#define | omListLast(ptr) |
|
#define | omListHasCycle(ptr) |
|
#define | omIsOnList(ptr, addr) |
|
#define | omRemoveFromList(ptr, addr) |
|
#define | omFindInList(ptr, what, value) |
|
#define | omInsertInSortedList(ptr, what, addr) |
|
#define | omFindInSortedList(ptr, what, value) |
|
#define | omRemoveFromSortedList(ptr, what, addr) |
|
#define | omTestList(ptr, level) |
|
#define | omCheckList(ptr, level, report, OM_FLR_VAL) |
|
#define | omCheckSortedList(ptr, what, level, report, OM_FLR_VAL) |
|
#define | omGListLength(ptr, next) |
|
#define | omGListLast(ptr, next) |
|
#define | omGListHasCycle(ptr, next) |
|
#define | omIsOnGList(ptr, next, addr) |
|
#define | omRemoveFromGList(ptr, next, addr) |
|
#define | omFindInGList(ptr, next, what, value) |
|
#define | omInsertInSortedGList(ptr, next, what, addr) |
|
#define | omFindInSortedGList(ptr, next, what, value) |
|
#define | omRemoveFromSortedGList(ptr, next, what, addr) |
|
#define | omTestGList(ptr, next, level) |
|
#define | omCheckGList(ptr, next, level, report, OM_FLR_VAL) |
|
#define | omCheckSortedGList(ptr, next, what, level, report, OM_FLR_VAL) |
|
|
int | _omListLength (void *list, int next) |
|
void * | _omListLast (void *list, int next) |
|
void * | _omListHasCycle (void *list, int next) |
|
void * | _omIsOnList (void *list, int next, void *addr) |
|
void * | _omRemoveFromList (void *list, int next, void *addr) |
|
void * | _omFindInList (void *list, int next, int long_field, unsigned long what) |
|
void * | _omFindInSortedList (void *list, int next, int long_field, unsigned long what) |
|
void * | _omRemoveFromSortedList (void *list, int next, int long_field, void *addr) |
|
void * | _omInsertInSortedList (void *list, int next, int long_field, void *addr) |
|
omError_t | _omCheckList (void *list, int next, int level, omError_t report, OM_FLR_DECL) |
|
omError_t | _omCheckSortedList (void *list, int next, int long_field, int level, omError_t report, OM_FLR_DECL) |
|
◆ OM_LIST_OFFSET
#define OM_LIST_OFFSET |
( |
| ptr, |
|
|
| name_of_offset_field ) |
Value: (ptr !=
NULL ? ((
char*) &(ptr->name_of_offset_field)) - ((
char*) ptr) : 0)
Definition at line 11 of file omList.h.
11#define OM_LIST_OFFSET(ptr, name_of_offset_field) \
12 (ptr != NULL ? ((char*) &(ptr->name_of_offset_field)) - ((char*) ptr) : 0)
◆ omCheckGList
#define omCheckGList |
( |
| ptr, |
|
|
| next, |
|
|
| level, |
|
|
| report, |
|
|
| OM_FLR_VAL ) |
Value:
omError_t _omCheckList(void *list, int next, int level, omError_t report, OM_FLR_DECL)
#define OM_LIST_OFFSET(ptr, name_of_offset_field)
Definition at line 115 of file omList.h.
115#define omCheckGList(ptr, next, level, report, OM_FLR_VAL) \
116 _omCheckList(ptr, OM_LIST_OFFSET(ptr,next), level, report, OM_FLR_VAL)
◆ omCheckList
#define omCheckList |
( |
| ptr, |
|
|
| level, |
|
|
| report, |
|
|
| OM_FLR_VAL ) |
Value:
Definition at line 83 of file omList.h.
83#define omCheckList(ptr, level, report, OM_FLR_VAL) \
84 _omCheckList(ptr, 0, level, report, OM_FLR_VAL)
◆ omCheckSortedGList
#define omCheckSortedGList |
( |
| ptr, |
|
|
| next, |
|
|
| what, |
|
|
| level, |
|
|
| report, |
|
|
| OM_FLR_VAL ) |
Value:
omError_t _omCheckSortedList(void *list, int next, int long_field, int level, omError_t report, OM_FLR_DECL)
Definition at line 117 of file omList.h.
117#define omCheckSortedGList(ptr, next, what, level, report, OM_FLR_VAL) \
118 _omCheckSortedList(ptr, OM_LIST_OFFSET(ptr,next), OM_LIST_OFFSET(ptr,what), level, report, OM_FLR_VAL)
◆ omCheckSortedList
#define omCheckSortedList |
( |
| ptr, |
|
|
| what, |
|
|
| level, |
|
|
| report, |
|
|
| OM_FLR_VAL ) |
Value:
Definition at line 85 of file omList.h.
85#define omCheckSortedList(ptr, what, level, report, OM_FLR_VAL) \
86 _omCheckSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), level, report, OM_FLR_VAL)
◆ omFindInGList
#define omFindInGList |
( |
| ptr, |
|
|
| next, |
|
|
| what, |
|
|
| value ) |
Value:
void * _omFindInList(void *list, int next, int long_field, unsigned long what)
Definition at line 104 of file omList.h.
104#define omFindInGList(ptr, next, what, value) \
105 _omFindInList(ptr, OM_LIST_OFFSET(ptr, next), OM_LIST_OFFSET(ptr, what), (unsigned long) value)
◆ omFindInList
#define omFindInList |
( |
| ptr, |
|
|
| what, |
|
|
| value ) |
Value:
Definition at line 72 of file omList.h.
72#define omFindInList(ptr, what, value) \
73 _omFindInList(ptr, 0, OM_LIST_OFFSET(ptr, what), (unsigned long) value)
◆ omFindInSortedGList
#define omFindInSortedGList |
( |
| ptr, |
|
|
| next, |
|
|
| what, |
|
|
| value ) |
Value:
void * _omFindInSortedList(void *list, int next, int long_field, unsigned long what)
Definition at line 108 of file omList.h.
108#define omFindInSortedGList(ptr, next, what, value) \
109 _omFindInSortedList(ptr, OM_LIST_OFFSET(ptr, next),OM_LIST_OFFSET(ptr,what),value)
◆ omFindInSortedList
#define omFindInSortedList |
( |
| ptr, |
|
|
| what, |
|
|
| value ) |
Value:
Definition at line 76 of file omList.h.
76#define omFindInSortedList(ptr, what, value) \
77 _omFindInSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), value)
◆ omGListHasCycle
#define omGListHasCycle |
( |
| ptr, |
|
|
| next ) |
Value:
void * _omListHasCycle(void *list, int next)
Definition at line 98 of file omList.h.
98#define omGListHasCycle(ptr, next) \
99 _omListHasCycle(ptr, OM_LIST_OFFSET(ptr, next))
◆ omGListLast
#define omGListLast |
( |
| ptr, |
|
|
| next ) |
Value:
void * _omListLast(void *list, int next)
Definition at line 96 of file omList.h.
96#define omGListLast(ptr, next) \
97 _omListLast(ptr, OM_LIST_OFFSET(ptr, next))
◆ omGListLength
#define omGListLength |
( |
| ptr, |
|
|
| next ) |
Value:
int _omListLength(void *list, int next)
Definition at line 94 of file omList.h.
94#define omGListLength(ptr, next) \
95 _omListLength(ptr, OM_LIST_OFFSET(ptr, next))
◆ omInsertInSortedGList
#define omInsertInSortedGList |
( |
| ptr, |
|
|
| next, |
|
|
| what, |
|
|
| addr ) |
Value:
void * _omInsertInSortedList(void *list, int next, int long_field, void *addr)
Definition at line 106 of file omList.h.
106#define omInsertInSortedGList(ptr, next, what, addr) \
107 _omInsertInSortedList(ptr, OM_LIST_OFFSET(ptr, next), OM_LIST_OFFSET(ptr, what), addr)
◆ omInsertInSortedList
#define omInsertInSortedList |
( |
| ptr, |
|
|
| what, |
|
|
| addr ) |
Value:
Definition at line 74 of file omList.h.
74#define omInsertInSortedList(ptr, what, addr) \
75 _omInsertInSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), addr)
◆ omIsOnGList
#define omIsOnGList |
( |
| ptr, |
|
|
| next, |
|
|
| addr ) |
Value:
void * _omIsOnList(void *list, int next, void *addr)
Definition at line 100 of file omList.h.
100#define omIsOnGList(ptr, next, addr) \
101 _omIsOnList(ptr, OM_LIST_OFFSET(ptr, next), addr)
◆ omIsOnList
#define omIsOnList |
( |
| ptr, |
|
|
| addr ) |
Value:
Definition at line 68 of file omList.h.
68#define omIsOnList(ptr, addr) \
69 _omIsOnList(ptr, 0, addr)
◆ omListHasCycle
#define omListHasCycle |
( |
| ptr | ) |
|
Value:
Definition at line 66 of file omList.h.
66#define omListHasCycle(ptr) \
67 _omListHasCycle(ptr, 0)
◆ omListLast
#define omListLast |
( |
| ptr | ) |
|
Value:
Definition at line 64 of file omList.h.
64#define omListLast(ptr) \
65 _omListLast(ptr, 0)
◆ omListLength
#define omListLength |
( |
| ptr | ) |
|
Value:
Definition at line 62 of file omList.h.
62#define omListLength(ptr) \
63 _omListLength(ptr, 0)
◆ omRemoveFromGList
#define omRemoveFromGList |
( |
| ptr, |
|
|
| next, |
|
|
| addr ) |
Value:
void * _omRemoveFromList(void *list, int next, void *addr)
Definition at line 102 of file omList.h.
102#define omRemoveFromGList(ptr, next, addr) \
103 _omRemoveFromList(ptr, OM_LIST_OFFSET(ptr, next), addr)
◆ omRemoveFromList
#define omRemoveFromList |
( |
| ptr, |
|
|
| addr ) |
Value:
Definition at line 70 of file omList.h.
70#define omRemoveFromList(ptr, addr) \
71 _omRemoveFromList(ptr, 0, addr)
◆ omRemoveFromSortedGList
#define omRemoveFromSortedGList |
( |
| ptr, |
|
|
| next, |
|
|
| what, |
|
|
| addr ) |
Value:
void * _omRemoveFromSortedList(void *list, int next, int long_field, void *addr)
Definition at line 110 of file omList.h.
110#define omRemoveFromSortedGList(ptr, next, what, addr) \
111 _omRemoveFromSortedList(ptr, OM_LIST_OFFSET(addr,next),OM_LIST_OFFSET(addr,what),addr)
◆ omRemoveFromSortedList
#define omRemoveFromSortedList |
( |
| ptr, |
|
|
| what, |
|
|
| addr ) |
Value:
Definition at line 78 of file omList.h.
78#define omRemoveFromSortedList(ptr, what, addr) \
79 _omRemoveFromSortedList(ptr, 0, OM_LIST_OFFSET(ptr, what), addr)
◆ omTestGList
Value:
#define omCheckGList(ptr, next, level, report, OM_FLR_VAL)
Definition at line 113 of file omList.h.
113#define omTestGList(ptr, next, level) \
114 omCheckGList(ptr, next, level, omError_NoError, OM_FLR)
◆ omTestList
#define omTestList |
( |
| ptr, |
|
|
| level ) |
Value:
Definition at line 81 of file omList.h.
81#define omTestList(ptr, level) \
82 _omCheckList(ptr, 0, level, omError_NoError, OM_FLR)
◆ _omCheckList()
omError_t _omCheckList |
( |
void * | list, |
|
|
int | next, |
|
|
int | level, |
|
|
omError_t | report, |
|
|
OM_FLR_DECL | ) |
Definition at line 178 of file omList.c.
179{
181
183 {
185 {
188 }
189 }
190 else
191 {
192 void* l1 = list;
193 void* l2;
195
196 l1 = list;
198 {
201 l2 = list;
202 while (l1 != l2)
203 {
206 }
211 }
212 }
214}
omError_t omCheckPtr(const void *ptr, omError_t report, OM_FLR_DECL)
#define omCheckReturn(cond)
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
◆ _omCheckSortedList()
omError_t _omCheckSortedList |
( |
void * | list, |
|
|
int | next, |
|
|
int | long_field, |
|
|
int | level, |
|
|
omError_t | report, |
|
|
OM_FLR_DECL | ) |
Definition at line 216 of file omList.c.
217{
219
221
223 {
225 {
227 if (prev !=
NULL &&
VALUE(prev, long_field) >
VALUE(list, long_field))
229 "%d > %d",
VALUE(prev, long_field),
VALUE(list, long_field));
230 prev = list;
232 }
233 }
234 else
235 {
236 void* l1 = list;
237 void* l2;
239
241 {
243 if (prev !=
NULL &&
VALUE(prev, long_field) >
VALUE(l1, long_field))
245 "%d > %d",
VALUE(prev, long_field),
VALUE(l1, long_field));
247 l2 = list;
248 while (l1 != l2)
249 {
252 }
254 prev = l1;
257 }
258 }
260}
#define omCheckReturnError(cond, error)
@ omError_SortedListError
#define VALUE(list, offset)
◆ _omFindInList()
void * _omFindInList |
( |
void * | list, |
|
|
int | next, |
|
|
int | long_field, |
|
|
unsigned long | what ) |
Definition at line 100 of file omList.c.
101{
103 {
104 if (
VALUE(list, long_field) == what)
return list;
106 }
108}
◆ _omFindInSortedList()
void * _omFindInSortedList |
( |
void * | list, |
|
|
int | next, |
|
|
int | long_field, |
|
|
unsigned long | what ) |
Definition at line 110 of file omList.c.
112{
114 {
115 if (
VALUE(list, long_field) >= what)
116 {
117 if (
VALUE(list, long_field) == what)
return list;
119 }
121 }
123}
◆ _omInsertInSortedList()
void * _omInsertInSortedList |
( |
void * | list, |
|
|
int | next, |
|
|
int | long_field, |
|
|
void * | addr ) |
Definition at line 148 of file omList.c.
149{
150 unsigned long what =
VALUE(addr, long_field);
151
152 if (list ==
NULL || what <=
VALUE(list, long_field))
153 {
155 return addr;
156 }
157 else
158 {
159 void* prev = list;
160 void* curr =
NEXT(list);
161
162 while (curr !=
NULL &&
VALUE(curr, long_field) < what)
163 {
164 prev = curr;
166 }
169 return list;
170 }
171}
◆ _omIsOnList()
void * _omIsOnList |
( |
void * | list, |
|
|
int | next, |
|
|
void * | addr ) |
Definition at line 66 of file omList.c.
67{
70
72 {
73 if (addr == list) return addr;
75 }
76 return 0;
77}
◆ _omListHasCycle()
void * _omListHasCycle |
( |
void * | list, |
|
|
int | next ) |
Definition at line 42 of file omList.c.
43{
44 void* l1 = list;
45 void* l2;
46
48
50 {
52 l2 = list;
53 while (l1 != l2)
54 {
57 }
58 if (
i !=
l)
return l1;
61 }
63}
◆ _omListLast()
void * _omListLast |
( |
void * | list, |
|
|
int | next ) |
Definition at line 32 of file omList.c.
33{
35
37
38 return list;
39}
◆ _omListLength()
int _omListLength |
( |
void * | list, |
|
|
int | next ) |
◆ _omRemoveFromList()
void * _omRemoveFromList |
( |
void * | list, |
|
|
int | next, |
|
|
void * | addr ) |
Definition at line 79 of file omList.c.
80{
81 void* nlist;
82 void* olist;
83
85
87 if (list == addr) return nlist;
88
89 olist = list;
90 while (nlist !=
NULL && nlist != addr)
91 {
92 list = nlist;
94 }
95
97 return olist;
98}
◆ _omRemoveFromSortedList()
void * _omRemoveFromSortedList |
( |
void * | list, |
|
|
int | next, |
|
|
int | long_field, |
|
|
void * | addr ) |
Definition at line 125 of file omList.c.
126{
127 void* nlist;
128 void* olist;
129 unsigned long what =
VALUE(addr, long_field);
130
133 if (list == addr) return nlist;
134 if (
VALUE(list, long_field) > what)
return list;
135
136 olist = list;
137 while (nlist !=
NULL && nlist != addr)
138 {
139 if (
VALUE(list, long_field) > what)
return olist;
140 list = nlist;
142 }
143
145 return olist;
146}