Deleted Added
full compact
queue.h (192908) queue.h (192926)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)queue.h 8.5 (Berkeley) 8/20/94
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)queue.h 8.5 (Berkeley) 8/20/94
30 * $FreeBSD: head/sys/sys/queue.h 192908 2009-05-27 16:36:54Z zml $
30 * $FreeBSD: head/sys/sys/queue.h 192926 2009-05-27 19:28:04Z ed $
31 */
32
33#ifndef _SYS_QUEUE_H_
34#define _SYS_QUEUE_H_
35
36#include <sys/cdefs.h>
37
38/*

--- 52 unchanged lines hidden (view full) ---

91 * _FOREACH_SAFE + + + +
92 * _FOREACH_REVERSE - - - +
93 * _FOREACH_REVERSE_SAFE - - - +
94 * _INSERT_HEAD + + + +
95 * _INSERT_BEFORE - + - +
96 * _INSERT_AFTER + + + +
97 * _INSERT_TAIL - - + +
98 * _CONCAT - - + +
31 */
32
33#ifndef _SYS_QUEUE_H_
34#define _SYS_QUEUE_H_
35
36#include <sys/cdefs.h>
37
38/*

--- 52 unchanged lines hidden (view full) ---

91 * _FOREACH_SAFE + + + +
92 * _FOREACH_REVERSE - - - +
93 * _FOREACH_REVERSE_SAFE - - - +
94 * _INSERT_HEAD + + + +
95 * _INSERT_BEFORE - + - +
96 * _INSERT_AFTER + + + +
97 * _INSERT_TAIL - - + +
98 * _CONCAT - - + +
99 * _REMOVE_AFTER + - + -
99 * _REMOVE_HEAD + - + -
100 * _REMOVE_HEAD + - + -
100 * _REMOVE_NEXT + - + -
101 * _REMOVE + + + +
102 *
103 */
104#ifdef QUEUE_MACRO_DEBUG
105/* Store the last 2 places the queue element or head was altered */
106struct qm_trace {
107 char * lastfile;
108 int lastline;

--- 82 unchanged lines hidden (view full) ---

191#define SLIST_REMOVE(head, elm, type, field) do { \
192 if (SLIST_FIRST((head)) == (elm)) { \
193 SLIST_REMOVE_HEAD((head), field); \
194 } \
195 else { \
196 struct type *curelm = SLIST_FIRST((head)); \
197 while (SLIST_NEXT(curelm, field) != (elm)) \
198 curelm = SLIST_NEXT(curelm, field); \
101 * _REMOVE + + + +
102 *
103 */
104#ifdef QUEUE_MACRO_DEBUG
105/* Store the last 2 places the queue element or head was altered */
106struct qm_trace {
107 char * lastfile;
108 int lastline;

--- 82 unchanged lines hidden (view full) ---

191#define SLIST_REMOVE(head, elm, type, field) do { \
192 if (SLIST_FIRST((head)) == (elm)) { \
193 SLIST_REMOVE_HEAD((head), field); \
194 } \
195 else { \
196 struct type *curelm = SLIST_FIRST((head)); \
197 while (SLIST_NEXT(curelm, field) != (elm)) \
198 curelm = SLIST_NEXT(curelm, field); \
199 SLIST_REMOVE_NEXT(head, curelm, field); \
199 SLIST_REMOVE_AFTER(curelm, field); \
200 } \
201 TRASHIT((elm)->field.sle_next); \
202} while (0)
203
200 } \
201 TRASHIT((elm)->field.sle_next); \
202} while (0)
203
204#define SLIST_REMOVE_NEXT(head, elm, field) do { \
204#define SLIST_REMOVE_AFTER(elm, field) do { \
205 SLIST_NEXT(elm, field) = \
206 SLIST_NEXT(SLIST_NEXT(elm, field), field); \
207} while (0)
208
209#define SLIST_REMOVE_HEAD(head, field) do { \
210 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
211} while (0)
212

--- 74 unchanged lines hidden (view full) ---

287#define STAILQ_REMOVE(head, elm, type, field) do { \
288 if (STAILQ_FIRST((head)) == (elm)) { \
289 STAILQ_REMOVE_HEAD((head), field); \
290 } \
291 else { \
292 struct type *curelm = STAILQ_FIRST((head)); \
293 while (STAILQ_NEXT(curelm, field) != (elm)) \
294 curelm = STAILQ_NEXT(curelm, field); \
205 SLIST_NEXT(elm, field) = \
206 SLIST_NEXT(SLIST_NEXT(elm, field), field); \
207} while (0)
208
209#define SLIST_REMOVE_HEAD(head, field) do { \
210 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
211} while (0)
212

--- 74 unchanged lines hidden (view full) ---

287#define STAILQ_REMOVE(head, elm, type, field) do { \
288 if (STAILQ_FIRST((head)) == (elm)) { \
289 STAILQ_REMOVE_HEAD((head), field); \
290 } \
291 else { \
292 struct type *curelm = STAILQ_FIRST((head)); \
293 while (STAILQ_NEXT(curelm, field) != (elm)) \
294 curelm = STAILQ_NEXT(curelm, field); \
295 STAILQ_REMOVE_NEXT(head, curelm, field); \
295 STAILQ_REMOVE_AFTER(head, curelm, field); \
296 } \
297 TRASHIT((elm)->field.stqe_next); \
298} while (0)
299
300#define STAILQ_REMOVE_HEAD(head, field) do { \
301 if ((STAILQ_FIRST((head)) = \
302 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
303 (head)->stqh_last = &STAILQ_FIRST((head)); \
304} while (0)
305
296 } \
297 TRASHIT((elm)->field.stqe_next); \
298} while (0)
299
300#define STAILQ_REMOVE_HEAD(head, field) do { \
301 if ((STAILQ_FIRST((head)) = \
302 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
303 (head)->stqh_last = &STAILQ_FIRST((head)); \
304} while (0)
305
306#define STAILQ_REMOVE_NEXT(head, elm, field) do { \
306#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
307 if ((STAILQ_NEXT(elm, field) = \
308 STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
309 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
310} while (0)
311
312#define STAILQ_SWAP(head1, head2, type) do { \
313 struct type *swap_first = STAILQ_FIRST(head1); \
314 struct type **swap_last = (head1)->stqh_last; \

--- 308 unchanged lines hidden ---
307 if ((STAILQ_NEXT(elm, field) = \
308 STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
309 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
310} while (0)
311
312#define STAILQ_SWAP(head1, head2, type) do { \
313 struct type *swap_first = STAILQ_FIRST(head1); \
314 struct type **swap_last = (head1)->stqh_last; \

--- 308 unchanged lines hidden ---