Last change
on this file since 4db0140 was
1379c96e,
checked in by Peter A. Buhr <pabuhr@…>, 6 months ago
|
formatting changes to programs
|
-
Property mode set to
100644
|
File size:
408 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; |
---|
[1379c96e] | 24 | LIST_ENTRY(req) d; |
---|
[5717495] | 25 | }; |
---|
| 26 | LIST_HEAD(reql, req); |
---|
| 27 | |
---|
| 28 | struct reql reqs; |
---|
| 29 | LIST_INIT(&reqs); |
---|
| 30 | |
---|
[1379c96e] | 31 | struct req r1 = {1, 42}, r2 = {2, 42}; |
---|
[5717495] | 32 | |
---|
[1379c96e] | 33 | LIST_INSERT_HEAD(&reqs, &r2, d); |
---|
| 34 | LIST_INSERT_HEAD(&reqs, &r1, d); |
---|
[5717495] | 35 | |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | struct req *cur; |
---|
[1379c96e] | 47 | LIST_FOREACH(cur, &reqs, d) |
---|
[5546f50b] | 48 | printf("{%d %d} ", cur->pri, cur->rqr); |
---|
[5717495] | 49 | printf("\n"); |
---|
| 50 | |
---|
[5546f50b] | 51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.