int test_datastructure_link_list() { llist_t *llist; allocator_t *allocator; struct test t1={1,2}; struct test t2={2,2}; struct test t3={3,2}; struct test t4={4,2}; int ret = 0; /* *allocator = allocator_creator(ALLOCATOR_TYPE_CTR_MALLOC); *allocator_ctr_init(allocator, 0, 0, 1024); *dbg_str(DBG_CONTAINER_DETAIL,"list allocator addr:%p",allocator); */ allocator = allocator_creator(ALLOCATOR_TYPE_SYS_MALLOC,0); //ct = container_creator(CONTAINER_TYPE_LIST,allocator); llist = llist_create(allocator,0); llist_init(llist,sizeof(struct test)); llist_push_front(llist,&t1); llist_push_front(llist,&t2); llist_push_front(llist,&t3); llist_push_front(llist,&t4); llist_push_back(llist,&t1); llist_push_back(llist,&t2); llist_push_back(llist,&t3); llist_push_back(llist,&t4); llist_for_each(llist,print_list_data); llist_destroy(llist); return ret; }
static inline void pushfront(LList* l, int val) { *(int*)llist_push_front(l) = val; }
void stone_add_modifier( t_stone *stone, s_modifier *mod) { llist_push_front( stone->modifier, mod); }