Whitespace and some better macro variable names.

* Renamed AST_LIST_TRAVERSE_SAFE_BEGIN __new_prev to __list_current.

* Renamed AST_LIST_MOVE_CURRENT __list_cur to __extracted.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342664 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2011-10-29 04:41:21 +00:00
parent f7ce570c35
commit 85dbd68f87

View File

@@ -529,14 +529,16 @@ struct { \
typeof((head)) __list_head = head; \
typeof(__list_head->first) __list_next; \
typeof(__list_head->first) __list_prev = NULL; \
typeof(__list_head->first) __new_prev = NULL; \
for ((var) = __list_head->first, __new_prev = (var), \
typeof(__list_head->first) __list_current; \
for ((var) = __list_head->first, \
__list_current = (var), \
__list_next = (var) ? (var)->field.next : NULL; \
(var); \
__list_prev = __new_prev, (var) = __list_next, \
__new_prev = (var), \
__list_prev = __list_current, \
(var) = __list_next, \
__list_current = (var), \
__list_next = (var) ? (var)->field.next : NULL, \
(void) __list_prev \
(void) __list_prev /* To quiet compiler? */ \
)
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN AST_LIST_TRAVERSE_SAFE_BEGIN
@@ -552,22 +554,34 @@ struct { \
* previous entry, if any).
*/
#define AST_LIST_REMOVE_CURRENT(field) do { \
__new_prev->field.next = NULL; \
__new_prev = __list_prev; \
if (__list_prev) \
__list_current->field.next = NULL; \
__list_current = __list_prev; \
if (__list_prev) { \
__list_prev->field.next = __list_next; \
else \
} else { \
__list_head->first = __list_next; \
if (!__list_next) \
} \
if (!__list_next) { \
__list_head->last = __list_prev; \
} \
} while (0)
#define AST_RWLIST_REMOVE_CURRENT AST_LIST_REMOVE_CURRENT
/*!
* \brief Move the current list entry to another list.
*
* \note This is a silly macro. It should be done explicitly
* otherwise the field parameter must be the same for the two
* lists.
*
* AST_LIST_REMOVE_CURRENT(field);
* AST_LIST_INSERT_TAIL(newhead, var, other_field);
*/
#define AST_LIST_MOVE_CURRENT(newhead, field) do { \
typeof ((newhead)->first) __list_cur = __new_prev; \
typeof ((newhead)->first) __extracted = __list_current; \
AST_LIST_REMOVE_CURRENT(field); \
AST_LIST_INSERT_TAIL((newhead), __list_cur, field); \
AST_LIST_INSERT_TAIL((newhead), __extracted, field); \
} while (0)
#define AST_RWLIST_MOVE_CURRENT AST_LIST_MOVE_CURRENT