|
|
|
@ -100,6 +100,23 @@ struct name { \
|
|
|
|
|
struct type *last; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Defines initial values for a declaration of AST_LIST_HEAD
|
|
|
|
|
*/
|
|
|
|
|
#define AST_LIST_HEAD_INIT_VALUE { \
|
|
|
|
|
.first = NULL, \
|
|
|
|
|
.last = NULL, \
|
|
|
|
|
.lock = AST_MUTEX_INIT_VALUE, \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK
|
|
|
|
|
*/
|
|
|
|
|
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE { \
|
|
|
|
|
.first = NULL, \
|
|
|
|
|
.last = NULL, \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Defines a structure to be used to hold a list of specified type, statically initialized.
|
|
|
|
|
\param name This will be the name of the defined structure.
|
|
|
|
@ -122,11 +139,18 @@ struct name { \
|
|
|
|
|
struct type *first; \
|
|
|
|
|
struct type *last; \
|
|
|
|
|
ast_mutex_t lock; \
|
|
|
|
|
} name = { \
|
|
|
|
|
.first = NULL, \
|
|
|
|
|
.last = NULL, \
|
|
|
|
|
.lock = AST_MUTEX_INIT_VALUE, \
|
|
|
|
|
};
|
|
|
|
|
} name = AST_LIST_HEAD_INIT_VALUE
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Defines a structure to be used to hold a list of specified type, statically initialized.
|
|
|
|
|
|
|
|
|
|
This is the same as AST_LIST_HEAD_STATIC, except without the lock included.
|
|
|
|
|
*/
|
|
|
|
|
#define AST_LIST_HEAD_NOLOCK_STATIC(name, type) \
|
|
|
|
|
struct name { \
|
|
|
|
|
struct type *first; \
|
|
|
|
|
struct type *last; \
|
|
|
|
|
} name = AST_LIST_HEAD_NOLOCK_INIT_VALUE
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Initializes a list head structure with a specified first entry.
|
|
|
|
@ -183,6 +207,12 @@ struct { \
|
|
|
|
|
*/
|
|
|
|
|
#define AST_LIST_FIRST(head) ((head)->first)
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Returns the last entry contained in a list.
|
|
|
|
|
\param head This is a pointer to the list tail structure
|
|
|
|
|
*/
|
|
|
|
|
#define AST_LIST_LAST(head) ((head)->last)
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\brief Returns the next entry in the list after the given entry.
|
|
|
|
|
\param elm This is a pointer to the current entry.
|
|
|
|
@ -433,11 +463,13 @@ struct { \
|
|
|
|
|
(head)->last = NULL; \
|
|
|
|
|
} else { \
|
|
|
|
|
typeof(elm) curelm = (head)->first; \
|
|
|
|
|
while (curelm->field.next != (elm)) \
|
|
|
|
|
while (curelm && (curelm->field.next != (elm))) \
|
|
|
|
|
curelm = curelm->field.next; \
|
|
|
|
|
curelm->field.next = (elm)->field.next; \
|
|
|
|
|
if ((head)->last == (elm)) \
|
|
|
|
|
(head)->last = curelm; \
|
|
|
|
|
if (curelm) { \
|
|
|
|
|
curelm->field.next = (elm)->field.next; \
|
|
|
|
|
if ((head)->last == (elm)) \
|
|
|
|
|
(head)->last = curelm; \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
(elm)->field.next = NULL; \
|
|
|
|
|
} while (0)
|
|
|
|
|