1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is the Netscape Portable Runtime (NSPR).
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998-2000
20
* the Initial Developer. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the MPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the MPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
43
typedef struct PRCListStr PRCList;
46
** Circular linked list
54
** Insert element "_e" into the list, before "_l".
56
#define PR_INSERT_BEFORE(_e,_l) \
59
(_e)->prev = (_l)->prev; \
60
(_l)->prev->next = (_e); \
65
** Insert element "_e" into the list, after "_l".
67
#define PR_INSERT_AFTER(_e,_l) \
69
(_e)->next = (_l)->next; \
71
(_l)->next->prev = (_e); \
76
** Return the element following element "_e"
78
#define PR_NEXT_LINK(_e) \
81
** Return the element preceding element "_e"
83
#define PR_PREV_LINK(_e) \
87
** Append an element "_e" to the end of the list "_l"
89
#define PR_APPEND_LINK(_e,_l) PR_INSERT_BEFORE(_e,_l)
92
** Insert an element "_e" at the head of the list "_l"
94
#define PR_INSERT_LINK(_e,_l) PR_INSERT_AFTER(_e,_l)
96
/* Return the head/tail of the list */
97
#define PR_LIST_HEAD(_l) (_l)->next
98
#define PR_LIST_TAIL(_l) (_l)->prev
101
** Remove the element "_e" from it's circular list.
103
#define PR_REMOVE_LINK(_e) \
105
(_e)->prev->next = (_e)->next; \
106
(_e)->next->prev = (_e)->prev; \
110
** Remove the element "_e" from it's circular list. Also initializes the
113
#define PR_REMOVE_AND_INIT_LINK(_e) \
115
(_e)->prev->next = (_e)->next; \
116
(_e)->next->prev = (_e)->prev; \
122
** Return non-zero if the given circular list "_l" is empty, zero if the
123
** circular list is not empty
125
#define PR_CLIST_IS_EMPTY(_l) \
129
** Initialize a circular list
131
#define PR_INIT_CLIST(_l) \
137
#define PR_INIT_STATIC_CLIST(_l) \
140
#endif /* prclist_h___ */