src/ucx/list.c

changeset 135
471e28cca288
parent 99
b9a6af0ae41a
child 254
4784c14aa639
equal deleted inserted replaced
134:44415e4399ce 135:471e28cca288
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2015 Olaf Wintermann. All rights reserved. 4 * Copyright 2016 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
74 e = e->next; 74 e = e->next;
75 alfree(alloc, f); 75 alfree(alloc, f);
76 } 76 }
77 } 77 }
78 78
79 void ucx_list_free_content(UcxList* list, ucx_destructor destr) {
80 while (list != NULL) {
81 destr(list->data);
82 list = list->next;
83 }
84 }
85
79 UcxList *ucx_list_append(UcxList *l, void *data) { 86 UcxList *ucx_list_append(UcxList *l, void *data) {
80 return ucx_list_append_a(ucx_default_allocator(), l, data); 87 return ucx_list_append_a(ucx_default_allocator(), l, data);
81 } 88 }
82 89
83 UcxList *ucx_list_append_a(UcxAllocator *alloc, UcxList *l, void *data) { 90 UcxList *ucx_list_append_a(UcxAllocator *alloc, UcxList *l, void *data) {

mercurial