Last change
on this file since 464 was 10, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
930 bytes
|
Line | |
---|
1 | /* insque(3C) routines
|
---|
2 | This file is in the public domain. */
|
---|
3 |
|
---|
4 | /*
|
---|
5 | NAME
|
---|
6 | insque, remque -- insert, remove an element from a queue
|
---|
7 |
|
---|
8 | SYNOPSIS
|
---|
9 | struct qelem {
|
---|
10 | struct qelem *q_forw;
|
---|
11 | struct qelem *q_back;
|
---|
12 | char q_data[];
|
---|
13 | };
|
---|
14 |
|
---|
15 | void insque (struct qelem *elem, struct qelem *pred)
|
---|
16 |
|
---|
17 | void remque (struct qelem *elem)
|
---|
18 |
|
---|
19 | DESCRIPTION
|
---|
20 | Routines to manipulate queues built from doubly linked lists.
|
---|
21 | The insque routine inserts ELEM in the queue immediately after
|
---|
22 | PRED. The remque routine removes ELEM from its containing queue.
|
---|
23 | */
|
---|
24 |
|
---|
25 |
|
---|
26 | struct qelem {
|
---|
27 | struct qelem *q_forw;
|
---|
28 | struct qelem *q_back;
|
---|
29 | };
|
---|
30 |
|
---|
31 |
|
---|
32 | void
|
---|
33 | insque (elem, pred)
|
---|
34 | struct qelem *elem;
|
---|
35 | struct qelem *pred;
|
---|
36 | {
|
---|
37 | elem -> q_forw = pred -> q_forw;
|
---|
38 | pred -> q_forw -> q_back = elem;
|
---|
39 | elem -> q_back = pred;
|
---|
40 | pred -> q_forw = elem;
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 | void
|
---|
45 | remque (elem)
|
---|
46 | struct qelem *elem;
|
---|
47 | {
|
---|
48 | elem -> q_forw -> q_back = elem -> q_back;
|
---|
49 | elem -> q_back -> q_forw = elem -> q_forw;
|
---|
50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.