Last change
on this file since a885357 was 5546f50b, checked in by Peter A. Buhr <pabuhr@…>, 19 months ago |
more switch to tabs
|
-
Property mode
set to
100644
|
File size:
415 bytes
|
Rev | Line | |
---|
[5717495] | 1 | #include <sys/queue.h>
|
---|
| 2 | #include <stdio.h>
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | int main() {
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | // C
|
---|
| 21 |
|
---|
| 22 | struct req {
|
---|
[5546f50b] | 23 | int pri, rqr;
|
---|
| 24 | LIST_ENTRY(req) x;
|
---|
[5717495] | 25 | };
|
---|
| 26 |
|
---|
| 27 | LIST_HEAD(reql, req);
|
---|
| 28 |
|
---|
| 29 | struct reql reqs;
|
---|
| 30 | LIST_INIT(&reqs);
|
---|
| 31 |
|
---|
| 32 | struct req
|
---|
[5546f50b] | 33 | r1 = {1, 42},
|
---|
| 34 | r2 = {2, 42};
|
---|
[5717495] | 35 |
|
---|
| 36 | LIST_INSERT_HEAD(
|
---|
[5546f50b] | 37 | &reqs, &r2, x);
|
---|
[5717495] | 38 | LIST_INSERT_HEAD(
|
---|
[5546f50b] | 39 | &reqs, &r1, x);
|
---|
[5717495] | 40 |
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | struct req *cur;
|
---|
| 52 | LIST_FOREACH(cur, &reqs, x)
|
---|
[5546f50b] | 53 | printf("{%d %d} ", cur->pri, cur->rqr);
|
---|
[5717495] | 54 | printf("\n");
|
---|
| 55 |
|
---|
[5546f50b] | 56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.