Lines Matching refs:array

40 * This is a resizeable array implementation designed primarily to maximize
41 * memory reuse. The array should only be allocated once, but it can be
43 * reallocates only if it needs to grow the internal array, such that memory
46 * one large array in the init function.
48 * A technique commonly used in kxld is to make an array of objects that
50 * the individual objects contained in an array should be cleared at the end of
52 * memory they have already allocated. The array that contains them should not
55 * allocated space of the array and clean up all potential instances contained
57 * requirements that must be met, and guarantees that the array implementation
61 * - A newly allocated, uninitialized array object must be zeroed out before
63 * - The objects stored in the array that will be reused must consider
73 * - The reset, clear, deinit functions will accept a NULL pointer to an array.
80 size_t itemsize; /* The size of the items that the array contains */
85 u_int nitems; /* The current number of items this array contains */
86 u_int maxitems; /* The maximum number of items this array can contain */
93 u_int nitems; /* The number of items the array contains */
104 /* Initializes the array's capacity to a minimum of nitems * itemsize */
105 kern_return_t kxld_array_init(KXLDArray *array, size_t itemsize, u_int nitems)
108 /* Performs a deep copy of the array */
109 kern_return_t kxld_array_copy(KXLDArray *array, const KXLDArray *src)
112 /* Sets the number of items in the array to 0 */
113 void kxld_array_reset(KXLDArray *array)
116 /* Zeroes out the array and sets nitems to 0 */
117 void kxld_array_clear(KXLDArray *array)
120 /* Frees the array's internal buffer */
121 void kxld_array_deinit(KXLDArray *array)
129 void *kxld_array_get_item(const KXLDArray *array, u_int idx)
133 void *kxld_array_get_slot(const KXLDArray *array, u_int idx)
136 /* Returns the index of a specified item in the array */
137 kern_return_t kxld_array_get_index(const KXLDArray *array, const void *item,
145 /* Grows the array to contain a minimum of nitems. If extra memory is needed,
147 * array.
149 kern_return_t kxld_array_resize(KXLDArray *array, u_int nitems)
152 /* Removes an element from the array. This is only supported for arrays with
155 kern_return_t kxld_array_remove(KXLDArray *array, u_int idx)