src/cx/array_list.h

changeset 610
de5d3ee6435f
parent 609
6ae8146d9f62
child 612
820ee59121b4
equal deleted inserted replaced
609:6ae8146d9f62 610:de5d3ee6435f
87 */ 87 */
88 size_t int2; 88 size_t int2;
89 }; 89 };
90 90
91 /** 91 /**
92 * Return codes for cx_array_copy().
93 */
94 enum cx_array_coppy_result {
95 CX_ARRAY_COPY_SUCCESS,
96 CX_ARRAY_COPY_REALLOC_NOT_SUPPORTED,
97 CX_ARRAY_COPY_REALLOC_FAILED,
98 };
99
100 /**
92 * Copies elements from one array to another. 101 * Copies elements from one array to another.
93 * 102 *
94 * The elements are copied to the \p target array at the specified \p index, 103 * The elements are copied to the \p target array at the specified \p index,
95 * overwriting possible elements. The index must be in range of the current 104 * overwriting possible elements. The index must be in range of the current
96 * array \p size. If the number of elements added would extend the array's size, 105 * array \p size. If the number of elements added would extend the array's size,
108 * @param src the source array 117 * @param src the source array
109 * @param elem_size the size of one element 118 * @param elem_size the size of one element
110 * @param elem_count the number of elements to copy 119 * @param elem_count the number of elements to copy
111 * @param reallocator the array re-allocator to use, or \c NULL 120 * @param reallocator the array re-allocator to use, or \c NULL
112 * if re-allocation shall not happen 121 * if re-allocation shall not happen
113 * @return zero on success, non-zero on failure 122 * @return zero on success, non-zero error code on failure
114 */ 123 */
115 int cx_array_copy( 124 enum cx_array_coppy_result cx_array_copy(
116 void **target, 125 void **target,
117 size_t *size, 126 size_t *size,
118 size_t *capacity, 127 size_t *capacity,
119 size_t index, 128 size_t index,
120 void const *src, 129 void const *src,
121 size_t elem_size, 130 size_t elem_size,
122 size_t elem_count, 131 size_t elem_count,
123 struct cx_array_reallocator_s const *reallocator 132 struct cx_array_reallocator_s *reallocator
124 ) __attribute__((__nonnull__(1, 2, 5))); 133 ) __attribute__((__nonnull__(1, 2, 5)));
125 134
126 /** 135 /**
127 * Allocates an array list for storing elements with \p item_size bytes each. 136 * Allocates an array list for storing elements with \p item_size bytes each.
128 * 137 *

mercurial