宏UT_LIST_ADD_FIRST

 

/*******************************************************************//**
Adds the node as the first element in a two-way linked list.
@param NAME    list name
@param BASE    the base node (not a pointer to it)
@param N    pointer to the node to be added to the list.
*/
#define UT_LIST_ADD_FIRST(NAME, BASE, N)\
{\
    ut_ad(N);\
    ((BASE).count)++;\
    ((N)->NAME).next = (BASE).start;\
    ((N)->NAME).prev = NULL;\
    if (UNIV_LIKELY((BASE).start != NULL)) {\
        ut_ad((BASE).start != (N));\
        (((BASE).start)->NAME).prev = (N);\
    }\
    (BASE).start = (N);\
    if (UNIV_UNLIKELY((BASE).end == NULL)) {\
        (BASE).end = (N);\
    }\
}\

 

你可能感兴趣的:(宏UT_LIST_ADD_FIRST)