--- libaitio/src/Attic/array.c 2011/08/31 12:29:32 1.4.2.1 +++ libaitio/src/Attic/array.c 2011/08/31 12:46:58 1.4.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: array.c,v 1.4.2.1 2011/08/31 12:29:32 misho Exp $ +* $Id: array.c,v 1.4.2.2 2011/08/31 12:46:58 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -370,6 +370,28 @@ io_arrayConcat(array_t * __restrict dest, array_t * __ memcpy(dest->arr_data + n, src->arr_data, io_arraySize(src) * sizeof(void*)); return io_arraySize(dest); +} + +/* + * io_arrayCopy() Copy source array to destination array + * @dest = Destination array, after use free with io_arrayDestroy() + * @src = Source array + * return: -1 error; >0 count of destination array + */ +int +io_arrayCopy(array_t ** __restrict dest, array_t * __restrict src) +{ + assert(dest); + assert(src); + if (!dest || !src) + return -1; + + *dest = io_arrayInit(io_arraySize(src)); + if (!*dest) + return -1; + + memcpy((*dest)->arr_data, src->arr_data, io_arraySize(*dest) * sizeof(void*)); + return io_arraySize(*dest); } /*