#include "omConfig.h"
#include "omalloc.h"
#include "omDebug.h"
Go to the source code of this file.
|
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) |
|
◆ _VALUE
#define _VALUE |
( |
|
list, |
|
|
|
offset |
|
) |
| *((void**) ((char *)list + offset)) |
◆ ITER
#define ITER |
( |
|
list | ) |
list = NEXT(list) |
◆ NEXT
◆ NULL
◆ VALUE
◆ _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}