138 memcpy(array->data, data, array->elemsize); |
138 memcpy(array->data, data, array->elemsize); |
139 } else { |
139 } else { |
140 memset(array->data, 0, array->elemsize); |
140 memset(array->data, 0, array->elemsize); |
141 } |
141 } |
142 |
142 |
|
143 return 0; |
|
144 } |
|
145 |
|
146 int ucx_array_set(UcxArray *array, size_t index, void *data) { |
|
147 if (index >= array->size) { |
|
148 if (ucx_array_reserve(array, index+1)) { |
|
149 return 1; |
|
150 } |
|
151 array->size = index+1; |
|
152 } |
|
153 |
|
154 void *dest = ucx_array_at(*array, index); |
|
155 if (data) { |
|
156 memcpy(dest, data, array->elemsize); |
|
157 } else { |
|
158 memset(dest, 0, array->elemsize); |
|
159 } |
|
160 |
143 return 0; |
161 return 0; |
144 } |
162 } |
145 |
163 |
146 int ucx_array_concat(UcxArray *array1, const UcxArray *array2) { |
164 int ucx_array_concat(UcxArray *array1, const UcxArray *array2) { |
147 |
165 |