1 /*
2 link.c
3
4 (description)
5
6 Copyright (C) 1996-1997 Id Software, Inc.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17 See the GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to:
21
22 Free Software Foundation, Inc.
23 59 Temple Place - Suite 330
24 Boston, MA 02111-1307, USA
25
26 */
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include "QF/link.h"
32
33
34 // ClearLink is used for new headnodes
35 VISIBLE void
ClearLink(link_t * l)36 ClearLink (link_t *l)
37 {
38 l->prev = l->next = l;
39 }
40
41 VISIBLE void
RemoveLink(link_t * l)42 RemoveLink (link_t *l)
43 {
44 l->next->prev = l->prev;
45 l->prev->next = l->next;
46 }
47
48 VISIBLE void
InsertLinkBefore(link_t * l,link_t * before)49 InsertLinkBefore (link_t *l, link_t *before)
50 {
51 l->next = before;
52 l->prev = before->prev;
53 l->prev->next = l;
54 l->next->prev = l;
55 }
56
57 VISIBLE void
InsertLinkAfter(link_t * l,link_t * after)58 InsertLinkAfter (link_t *l, link_t *after)
59 {
60 l->next = after->next;
61 l->prev = after;
62 l->prev->next = l;
63 l->next->prev = l;
64 }
65