--- libaitio/inc/aitio.h 2011/08/31 12:29:32 1.11.2.6 +++ libaitio/inc/aitio.h 2011/09/01 08:13:10 1.11.2.10 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.11.2.6 2011/08/31 12:29:32 misho Exp $ +* $Id: aitio.h,v 1.11.2.10 2011/09/01 08:13:10 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -240,7 +240,7 @@ inline const char *io_GetError(); * @vars = Variable array * return: -1 error, 0 nothing done or >0 size of marshaled data */ -int io_vals2buffer(unsigned char **buf, int buflen, array_t *vars); +int io_vals2buffer(unsigned char *buf, int buflen, array_t *vars); /* * io_buffer2vals() De-marshaling data from buffer to array with variables * @buf = Buffer @@ -403,6 +403,13 @@ inline int io_arrayLen(array_t * __restrict arr); */ int io_arrayConcat(array_t * __restrict dest, array_t * __restrict src); /* + * 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); +/* * io_arrayGrow() - Grow/Shrink dynamic array, Use with care when it shrink!!! * @arr = Array * @newNumItems = Number of Items @@ -418,7 +425,7 @@ int io_arrayGrow(array_t * __restrict arr, int newNumI */ int io_arrayVacuum(array_t * __restrict arr, int fromWhere); -#define io_arraySize(_arr) (assert((_arr)), (_arr)->arr_num) +#define io_arraySize(_arr) ((_arr) ? (_arr)->arr_num : 0) #define io_arrayZero(_arr) (assert((_arr)), memset((_arr)->arr_data, 0, \ io_arraySize((_arr)) * sizeof(void*))) @@ -511,7 +518,15 @@ int io_sarrGrow(sarr_t * __restrict arr, int newNumIte * return: -1 error, >-1 freed segments */ inline int io_sarrVacuum(sarr_t * __restrict arr); -#define io_sarrSize(_arr) (assert((_arr)), (_arr)->sarr_num) +#define io_sarrSize(_arr) ((_arr) ? (_arr)->sarr_num : 0) +#define io_sarrSeg(_arr) (assert((_arr)), (_arr)->sarr_seg) +/* + * io_sarrCopy() Copy source split array to destination split array + * @dest = Destination split array, after use free with io_sarrDestroy() + * @src = Source split array + * return: -1 error; >0 count of destination split array + */ +int io_sarrCopy(sarr_t ** __restrict dest, sarr_t * __restrict src); /* * io_sarrGet() - Get element from dynamic split-order array * @arr = Array