queue.h (191535) | queue.h (192908) |
---|---|
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 191535 2009-04-26 21:06:11Z ed $ | 30 * $FreeBSD: head/sys/sys/queue.h 192908 2009-05-27 16:36:54Z zml $ |
31 */ 32 33#ifndef _SYS_QUEUE_H_ 34#define _SYS_QUEUE_H_ 35 36#include <sys/cdefs.h> 37 38/* --- 265 unchanged lines hidden (view full) --- 304} while (0) 305 306#define STAILQ_REMOVE_NEXT(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 | 31 */ 32 33#ifndef _SYS_QUEUE_H_ 34#define _SYS_QUEUE_H_ 35 36#include <sys/cdefs.h> 37 38/* --- 265 unchanged lines hidden (view full) --- 304} while (0) 305 306#define STAILQ_REMOVE_NEXT(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; \ 315 STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ 316 (head1)->stqh_last = (head2)->stqh_last; \ 317 STAILQ_FIRST(head2) = swap_first; \ 318 (head2)->stqh_last = swap_last; \ 319 if (STAILQ_EMPTY(head1)) \ 320 (head1)->stqh_last = &STAILQ_FIRST(head1); \ 321 if (STAILQ_EMPTY(head2)) \ 322 (head2)->stqh_last = &STAILQ_FIRST(head2); \ 323} while (0) 324 325 |
|
312/* 313 * List declarations. 314 */ 315#define LIST_HEAD(name, type) \ 316struct name { \ 317 struct type *lh_first; /* first element */ \ 318} 319 --- 86 unchanged lines hidden (view full) --- 406 if (LIST_NEXT((elm), field) != NULL) \ 407 LIST_NEXT((elm), field)->field.le_prev = \ 408 (elm)->field.le_prev; \ 409 *(elm)->field.le_prev = LIST_NEXT((elm), field); \ 410 TRASHIT((elm)->field.le_next); \ 411 TRASHIT((elm)->field.le_prev); \ 412} while (0) 413 | 326/* 327 * List declarations. 328 */ 329#define LIST_HEAD(name, type) \ 330struct name { \ 331 struct type *lh_first; /* first element */ \ 332} 333 --- 86 unchanged lines hidden (view full) --- 420 if (LIST_NEXT((elm), field) != NULL) \ 421 LIST_NEXT((elm), field)->field.le_prev = \ 422 (elm)->field.le_prev; \ 423 *(elm)->field.le_prev = LIST_NEXT((elm), field); \ 424 TRASHIT((elm)->field.le_next); \ 425 TRASHIT((elm)->field.le_prev); \ 426} while (0) 427 |
428#define LIST_SWAP(head1, head2, type, field) do { \ 429 struct type *swap_tmp = LIST_FIRST((head1)); \ 430 LIST_FIRST((head1)) = LIST_FIRST((head2)); \ 431 LIST_FIRST((head2)) = swap_tmp; \ 432 if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ 433 swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ 434 if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ 435 swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ 436} while (0) 437 |
|
414/* 415 * Tail queue declarations. 416 */ 417#define TAILQ_HEAD(name, type) \ 418struct name { \ 419 struct type *tqh_first; /* first element */ \ 420 struct type **tqh_last; /* addr of last next element */ \ 421 TRACEBUF \ --- 151 unchanged lines hidden (view full) --- 573 QMD_TRACE_HEAD(head); \ 574 } \ 575 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ 576 TRASHIT((elm)->field.tqe_next); \ 577 TRASHIT((elm)->field.tqe_prev); \ 578 QMD_TRACE_ELEM(&(elm)->field); \ 579} while (0) 580 | 438/* 439 * Tail queue declarations. 440 */ 441#define TAILQ_HEAD(name, type) \ 442struct name { \ 443 struct type *tqh_first; /* first element */ \ 444 struct type **tqh_last; /* addr of last next element */ \ 445 TRACEBUF \ --- 151 unchanged lines hidden (view full) --- 597 QMD_TRACE_HEAD(head); \ 598 } \ 599 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ 600 TRASHIT((elm)->field.tqe_next); \ 601 TRASHIT((elm)->field.tqe_prev); \ 602 QMD_TRACE_ELEM(&(elm)->field); \ 603} while (0) 604 |
605#define TAILQ_SWAP(head1, head2, type, field) do { \ 606 struct type *swap_first = (head1)->tqh_first; \ 607 struct type **swap_last = (head1)->tqh_last; \ 608 (head1)->tqh_first = (head2)->tqh_first; \ 609 (head1)->tqh_last = (head2)->tqh_last; \ 610 (head2)->tqh_first = swap_first; \ 611 (head2)->tqh_last = swap_last; \ 612 if ((swap_first = (head1)->tqh_first) != NULL) \ 613 swap_first->field.tqe_prev = &(head1)->tqh_first; \ 614 else \ 615 (head1)->tqh_last = &(head1)->tqh_first; \ 616 if ((swap_first = (head2)->tqh_first) != NULL) \ 617 swap_first->field.tqe_prev = &(head2)->tqh_first; \ 618 else \ 619 (head2)->tqh_last = &(head2)->tqh_first; \ 620} while (0) 621 |
|
581#endif /* !_SYS_QUEUE_H_ */ | 622#endif /* !_SYS_QUEUE_H_ */ |