* new parsing option
[binutils-gdb.git] / libiberty / insque.c
blob775019f8fffc9bbd3bae8d04c1870d7e1caf190a
1 /* insque(3C) routines
2 This file is in the public domain. */
4 /*
5 NAME
6 insque, remque -- insert, remove an element from a queue
8 SYNOPSIS
9 struct qelem {
10 struct qelem *q_forw;
11 struct qelem *q_back;
12 char q_data[];
15 void insque (struct qelem *elem, struct qelem *pred)
17 void remque (struct qelem *elem)
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.
26 struct qelem {
27 struct qelem *q_forw;
28 struct qelem *q_back;
32 void
33 insque (elem, pred)
34 struct qelem *elem;
35 struct qelem *pred;
37 elem -> q_forw = pred -> q_forw;
38 pred -> q_forw -> q_back = elem;
39 elem -> q_back = pred;
40 pred -> q_forw = elem;
44 void
45 remque (elem)
46 struct qelem *elem;
48 elem -> q_forw -> q_back = elem -> q_back;
49 elem -> q_back -> q_forw = elem -> q_forw;