* mips-tdep.c (mips_eabi_push_dummy_call): Place signed, rather
[deliverable/binutils-gdb.git] / libiberty / insque.c
CommitLineData
252b5132
RH
1/* insque(3C) routines
2 This file is in the public domain. */
3
4/*
252b5132 5
ba19b94f
DD
6@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
7@deftypefnx Supplemental void remque (struct qelem *@var{elem})
252b5132 8
ba19b94f
DD
9Routines to manipulate queues built from doubly linked lists. The
10@code{insque} routine inserts @var{elem} in the queue immediately
11after @var{pred}. The @code{remque} routine removes @var{elem} from
12its containing queue. These routines expect to be passed pointers to
13structures which have as their first members a forward pointer and a
14back pointer, like this prototype (although no prototype is provided):
252b5132 15
ba19b94f
DD
16@example
17struct qelem @{
18 struct qelem *q_forw;
19 struct qelem *q_back;
20 char q_data[];
21@};
22@end example
23
24@end deftypefn
252b5132 25
252b5132
RH
26*/
27
28
29struct qelem {
30 struct qelem *q_forw;
31 struct qelem *q_back;
32};
33
34
35void
49b1fae4 36insque (struct qelem *elem, struct qelem *pred)
252b5132
RH
37{
38 elem -> q_forw = pred -> q_forw;
39 pred -> q_forw -> q_back = elem;
40 elem -> q_back = pred;
41 pred -> q_forw = elem;
42}
43
44
45void
49b1fae4 46remque (struct qelem *elem)
252b5132
RH
47{
48 elem -> q_forw -> q_back = elem -> q_back;
49 elem -> q_back -> q_forw = elem -> q_forw;
50}
This page took 0.589788 seconds and 4 git commands to generate.