OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [libiberty/] [insque.c] - Blame information for rev 438

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* insque(3C) routines
2
   This file is in the public domain.  */
3
 
4
/*
5
 
6
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
7
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
8
 
9
Routines to manipulate queues built from doubly linked lists.  The
10
@code{insque} routine inserts @var{elem} in the queue immediately
11
after @var{pred}.  The @code{remque} routine removes @var{elem} from
12
its containing queue.  These routines expect to be passed pointers to
13
structures which have as their first members a forward pointer and a
14
back pointer, like this prototype (although no prototype is provided):
15
 
16
@example
17
struct qelem @{
18
  struct qelem *q_forw;
19
  struct qelem *q_back;
20
  char q_data[];
21
@};
22
@end example
23
 
24
@end deftypefn
25
 
26
*/
27
 
28
 
29
struct qelem {
30
  struct qelem *q_forw;
31
  struct qelem *q_back;
32
};
33
 
34
 
35
void
36
insque (struct qelem *elem, struct qelem *pred)
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
 
45
void
46
remque (struct qelem *elem)
47
{
48
  elem -> q_forw -> q_back = elem -> q_back;
49
  elem -> q_back -> q_forw = elem -> q_forw;
50
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.