Sat, 12 Nov 2022 15:56:58 +0100
add array list tests
universe@606 | 1 | /* |
universe@606 | 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
universe@606 | 3 | * |
universe@606 | 4 | * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. |
universe@606 | 5 | * |
universe@606 | 6 | * Redistribution and use in source and binary forms, with or without |
universe@606 | 7 | * modification, are permitted provided that the following conditions are met: |
universe@606 | 8 | * |
universe@606 | 9 | * 1. Redistributions of source code must retain the above copyright |
universe@606 | 10 | * notice, this list of conditions and the following disclaimer. |
universe@606 | 11 | * |
universe@606 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
universe@606 | 13 | * notice, this list of conditions and the following disclaimer in the |
universe@606 | 14 | * documentation and/or other materials provided with the distribution. |
universe@606 | 15 | * |
universe@606 | 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
universe@606 | 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
universe@606 | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
universe@606 | 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
universe@606 | 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
universe@606 | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
universe@606 | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
universe@606 | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
universe@606 | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
universe@606 | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
universe@606 | 26 | * POSSIBILITY OF SUCH DAMAGE. |
universe@606 | 27 | */ |
universe@606 | 28 | /** |
universe@606 | 29 | * \file array_list.h |
universe@606 | 30 | * \brief Array list implementation. |
universe@606 | 31 | * \details Also provides several low-level functions for custom array list implementations. |
universe@606 | 32 | * \author Mike Becker |
universe@606 | 33 | * \author Olaf Wintermann |
universe@606 | 34 | * \version 3.0 |
universe@606 | 35 | * \copyright 2-Clause BSD License |
universe@606 | 36 | */ |
universe@606 | 37 | |
universe@606 | 38 | |
universe@606 | 39 | #ifndef UCX_ARRAY_LIST_H |
universe@606 | 40 | #define UCX_ARRAY_LIST_H |
universe@606 | 41 | |
universe@606 | 42 | #include "cx/list.h" |
universe@606 | 43 | |
universe@606 | 44 | #ifdef __cplusplus |
universe@606 | 45 | extern "C" { |
universe@606 | 46 | #endif |
universe@606 | 47 | |
universe@606 | 48 | /** |
universe@606 | 49 | * Allocates an array list for storing elements with \p item_size bytes each. |
universe@606 | 50 | * |
universe@606 | 51 | * @param allocator the allocator for allocating the list memory |
universe@606 | 52 | * @param comparator the comparator for the elements |
universe@606 | 53 | * @param item_size the size of each element in bytes |
universe@606 | 54 | * @param initial_capacity the initial number of elements the array can store |
universe@606 | 55 | * @return the created list |
universe@606 | 56 | */ |
universe@606 | 57 | CxList *cxArrayListCreate( |
universe@606 | 58 | CxAllocator const *allocator, |
universe@606 | 59 | CxListComparator comparator, |
universe@606 | 60 | size_t item_size, |
universe@606 | 61 | size_t initial_capacity |
universe@606 | 62 | ) __attribute__((__nonnull__)); |
universe@606 | 63 | |
universe@606 | 64 | |
universe@606 | 65 | #ifdef __cplusplus |
universe@606 | 66 | } /* extern "C" */ |
universe@606 | 67 | #endif |
universe@606 | 68 | |
universe@606 | 69 | #endif /* UCX_ARRAY_LIST_H */ |