示例#1
0
文件: list.c 项目: jasonkfirth/fbc
/** Initializes a list.
 *
 * This list implementation is based on a static array.
 *
 * @param list      Pointer to list structure to initialize.
 * @param table     Pointer to the pool of available list elements.
 * @param elem_size Size of elements in the array.
 * @param size      Number of elements in the array.
 */
void fb_hListInit( FB_LIST *list, void *table, int elem_size, int size )
{
	int i;
	FB_LISTELEM *next;
    unsigned char *elem = (unsigned char *)table;

    fb_hListDynInit( list );
	
	list->fhead = (FB_LISTELEM *)elem;
	
	for( i = 0; i < size; i++ )
	{
		if( i < size-1 )
			next = (FB_LISTELEM *)(elem + elem_size);
		else
			next = NULL;
		((FB_LISTELEM *)elem)->prev = NULL;
		((FB_LISTELEM *)elem)->next = next;
		
		elem += elem_size;
	}
}
示例#2
0
文件: io_printer.c 项目: VlaBst6/fbc
/** Initialize the list of device info nodes.
 */
static void
fb_hListDevInit      ( FB_LIST *list )
{
    fb_hListDynInit( list );
}