ucx/list.c

changeset 173
31a8682fffb7
parent 172
7084e8e8433c
child 177
11ad03783baf
equal deleted inserted replaced
172:7084e8e8433c 173:31a8682fffb7
70 void ucx_list_free_a(UcxAllocator *alloc, UcxList *l) { 70 void ucx_list_free_a(UcxAllocator *alloc, UcxList *l) {
71 UcxList *e = l, *f; 71 UcxList *e = l, *f;
72 while (e != NULL) { 72 while (e != NULL) {
73 f = e; 73 f = e;
74 e = e->next; 74 e = e->next;
75 alloc->free(alloc->pool, f); 75 alfree(alloc, f);
76 } 76 }
77 } 77 }
78 78
79 UcxList *ucx_list_append(UcxList *l, void *data) { 79 UcxList *ucx_list_append(UcxList *l, void *data) {
80 return ucx_list_append_a(ucx_default_allocator(), l, data); 80 return ucx_list_append_a(ucx_default_allocator(), l, data);
81 } 81 }
82 82
83 UcxList *ucx_list_append_a(UcxAllocator *alloc, UcxList *l, void *data) { 83 UcxList *ucx_list_append_a(UcxAllocator *alloc, UcxList *l, void *data) {
84 UcxList *nl = (UcxList*) alloc->malloc(alloc->pool, sizeof(UcxList)); 84 UcxList *nl = (UcxList*) almalloc(alloc, sizeof(UcxList));
85 if (!nl) { 85 if (!nl) {
86 return NULL; 86 return NULL;
87 } 87 }
88 88
89 nl->data = data; 89 nl->data = data;
321 321
322 if (e->prev) { 322 if (e->prev) {
323 e->prev->next = e->next; 323 e->prev->next = e->next;
324 } 324 }
325 325
326 alloc->free(alloc->pool, e); 326 alfree(alloc, e);
327 return l; 327 return l;
328 } 328 }

mercurial