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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [libiberty/] [insque.c] - Diff between revs 156 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 156 Rev 816
/* insque(3C) routines
/* insque(3C) routines
   This file is in the public domain.  */
   This file is in the public domain.  */
 
 
/*
/*
 
 
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
 
 
Routines to manipulate queues built from doubly linked lists.  The
Routines to manipulate queues built from doubly linked lists.  The
@code{insque} routine inserts @var{elem} in the queue immediately
@code{insque} routine inserts @var{elem} in the queue immediately
after @var{pred}.  The @code{remque} routine removes @var{elem} from
after @var{pred}.  The @code{remque} routine removes @var{elem} from
its containing queue.  These routines expect to be passed pointers to
its containing queue.  These routines expect to be passed pointers to
structures which have as their first members a forward pointer and a
structures which have as their first members a forward pointer and a
back pointer, like this prototype (although no prototype is provided):
back pointer, like this prototype (although no prototype is provided):
 
 
@example
@example
struct qelem @{
struct qelem @{
  struct qelem *q_forw;
  struct qelem *q_forw;
  struct qelem *q_back;
  struct qelem *q_back;
  char q_data[];
  char q_data[];
@};
@};
@end example
@end example
 
 
@end deftypefn
@end deftypefn
 
 
*/
*/
 
 
 
 
struct qelem {
struct qelem {
  struct qelem *q_forw;
  struct qelem *q_forw;
  struct qelem *q_back;
  struct qelem *q_back;
};
};
 
 
 
 
void
void
insque (struct qelem *elem, struct qelem *pred)
insque (struct qelem *elem, struct qelem *pred)
{
{
  elem -> q_forw = pred -> q_forw;
  elem -> q_forw = pred -> q_forw;
  pred -> q_forw -> q_back = elem;
  pred -> q_forw -> q_back = elem;
  elem -> q_back = pred;
  elem -> q_back = pred;
  pred -> q_forw = elem;
  pred -> q_forw = elem;
}
}
 
 
 
 
void
void
remque (struct qelem *elem)
remque (struct qelem *elem)
{
{
  elem -> q_forw -> q_back = elem -> q_back;
  elem -> q_forw -> q_back = elem -> q_back;
  elem -> q_back -> q_forw = elem -> q_forw;
  elem -> q_back -> q_forw = elem -> q_forw;
}
}
 
 

powered by: WebSVN 2.1.0

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