source: doc/theses/mike_brooks_MMath/programs/lst-issues-intrusive.run.c @ 9398177

Last change on this file since 9398177 was 5546f50b, checked in by Peter A. Buhr <pabuhr@…>, 6 months ago

more switch to tabs

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