src/list.c
void
init_static_list(staticList10_T *sl)
{
    list_T  *l = &sl->sl_list;
    int	    i;

    memset(sl, 0, sizeof(staticList10_T));
    l->lv_first = &sl->sl_items[0];
    l->lv_last = &sl->sl_items[9];
    l->lv_refcount = DO_NOT_FREE_CNT;
    l->lv_lock = VAR_FIXED;
    sl->sl_list.lv_len = 10;

    for (i = 0; i < 10; ++i)
    {
	listitem_T *li = &sl->sl_items[i];

	if (i == 0)
	    li->li_prev = NULL;
	else
	    li->li_prev = li - 1;
	if (i == 9)
	    li->li_next = NULL;
	else
	    li->li_next = li + 1;
    }
}
/*
 * Initialize a static list with 10 items.
 */
Initialize a static list with 10 items.
Initialize a static list with 10 items .
void
init_static_list(staticList10_T *sl)
{
    list_T  *l = &sl->sl_list;
    int	    i;
    memset(sl, 0, sizeof(staticList10_T));
    l->lv_first = &sl->sl_items[0];
    l->lv_last = &sl->sl_items[9];
    l->lv_refcount = DO_NOT_FREE_CNT;
    l->lv_lock = VAR_FIXED;
    sl->sl_list.lv_len = 10;
    for (i = 0; i < 10; ++i)
    {
	listitem_T *li = &sl->sl_items[i];
	if (i == 0)
	    li->li_prev = NULL;
	else
	    li->li_prev = li - 1;
	if (i == 9)
	    li->li_next = NULL;
	else
	    li->li_next = li + 1;
    }
}
void init_static_list ( staticList10_T * sl ) { list_T * l = & sl -> sl_list ; int i ; memset ( sl , 0 , sizeof ( staticList10_T ) ) ; l -> lv_first = & sl -> sl_items [ 0 ] ; l -> lv_last = & sl -> sl_items [ 9 ] ; l -> lv_refcount = DO_NOT_FREE_CNT ; l -> lv_lock = VAR_FIXED ; sl -> sl_list . lv_len = 10 ; for ( i = 0 ; i < 10 ; ++ i ) { listitem_T * li = & sl -> sl_items [ i ] ; if ( i == 0 ) li -> li_prev = NULL ; else li -> li_prev = li - 1 ; if ( i == 9 ) li -> li_next = NULL ; else li -> li_next = li + 1 ; } }
Initialize a static list with 10 items.
Initialize a static list with 10 items .