Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
libuvc
utlist.h
Go to the documentation of this file.
1
/*
2
Copyright (c) 2007-2010, Troy D. Hanson http://uthash.sourceforge.net
3
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 are met:
7
8
* Redistributions of source code must retain the above copyright
9
notice, this list of conditions and the following disclaimer.
10
11
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
12
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
13
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
15
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
*/
23
24
#ifndef UTLIST_H
25
#define UTLIST_H
26
27
#define UTLIST_VERSION 1.9.1
28
29
/******************************************************************************
30
* doubly linked list macros (non-circular) *
31
*****************************************************************************/
32
#define DL_PREPEND(head,add) \
33
do { \
34
(add)->next = head; \
35
if (head) { \
36
(add)->prev = (head)->prev; \
37
(head)->prev = (add); \
38
} else { \
39
(add)->prev = (add); \
40
} \
41
(head) = (add); \
42
} while (0)
43
44
#define DL_APPEND(head,add) \
45
do { \
46
if (head) { \
47
(add)->prev = (head)->prev; \
48
(head)->prev->next = (add); \
49
(head)->prev = (add); \
50
(add)->next = NULL; \
51
} else { \
52
(head)=(add); \
53
(head)->prev = (head); \
54
(head)->next = NULL; \
55
} \
56
} while (0);
57
58
#define DL_DELETE(head,del) \
59
do { \
60
if ((del)->prev == (del)) { \
61
(head)=NULL; \
62
} else if ((del)==(head)) { \
63
(del)->next->prev = (del)->prev; \
64
(head) = (del)->next; \
65
} else { \
66
(del)->prev->next = (del)->next; \
67
if ((del)->next) { \
68
(del)->next->prev = (del)->prev; \
69
} else { \
70
(head)->prev = (del)->prev; \
71
} \
72
} \
73
} while (0);
74
75
76
#define DL_FOREACH(head,el) \
77
for(el=head;el;el=el->next)
78
79
/* this version is safe for deleting the elements during iteration */
80
#define DL_FOREACH_SAFE(head,el,tmp) \
81
for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
82
83
/* these are identical to their singly-linked list counterparts */
84
#define DL_SEARCH_SCALAR LL_SEARCH_SCALAR
85
#define DL_SEARCH LL_SEARCH
86
87
#endif
88
librealsense
Author(s): Sergey Dorodnicov
, Mark Horn
, Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:18