1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17:
18:
19: #include <sys/queue.h>
20:
21: #define QUESEARCH(NAME, TYPE, COND) \
22: QUEUE* QueSearch##NAME( QUEUE *start, QUEUE *end, TYPE val, W offset ) \
23: { \
24: QUEUE *que; \
25: for ( que = start->next; que != end; que = que->next ) { \
26: if ( *(TYPE*)((VB*)que + offset) COND val ) { \
27: break; \
28: } \
29: } \
30: return que; \
31: }
32:
33: #define QUESEARCHREV(NAME, TYPE, COND) \
34: QUEUE* QueSearchRev##NAME( QUEUE *start, QUEUE *end, TYPE val, W offset )\
35: { \
36: QUEUE *que; \
37: for ( que = start->prev; que != end; que = que->prev ) { \
38: if ( *(TYPE*)((VB*)que + offset) COND val ) { \
39: break; \
40: } \
41: } \
42: return que; \
43: }