version 1.3.2.1, 2011/08/25 14:31:32
|
version 1.4, 2011/08/29 12:00:57
|
Line 90 io_sarrDestroy(sarr_t ** __restrict parr)
|
Line 90 io_sarrDestroy(sarr_t ** __restrict parr)
|
{ |
{ |
register int i; |
register int i; |
|
|
assert(parr); | assert(parr && *parr); |
if (!parr) | if (!parr || !*parr) |
return; |
return; |
|
|
for (i = 0; i < (*parr)->sarr_siz; i++) |
for (i = 0; i < (*parr)->sarr_siz; i++) |
Line 264 io_sarrSet(sarr_t * __restrict arr, u_int idx, void *d
|
Line 264 io_sarrSet(sarr_t * __restrict arr, u_int idx, void *d
|
array_t * |
array_t * |
io_sarr2array(sarr_t ** __restrict sa, int sarrFree) |
io_sarr2array(sarr_t ** __restrict sa, int sarrFree) |
{ |
{ |
return NULL; | array_t *arr = NULL; |
| int el; |
| register int i; |
| |
| assert(sa && *sa); |
| if (!sa || !*sa) |
| return NULL; |
| |
| el = io_sarrSize(*sa); |
| arr = io_arrayInit(el); |
| if (!arr) |
| return NULL; |
| |
| for (i = 0; i < el; i++) |
| io_arraySet(arr, i, io_sarrGet(*sa, i + 1)); |
| |
| if (sarrFree) { |
| free(*sa); |
| *sa = NULL; |
| } |
| return arr; |
} |
} |
|
|
/* |
/* |
* io_array2sarr() - Convert from dynamic array to split-order array |
* io_array2sarr() - Convert from dynamic array to split-order array |
* @a = array |
* @a = array |
|
* @segLen = Length of segment |
* @arrFree = after convert array !=0 will be destroyed |
* @arrFree = after convert array !=0 will be destroyed |
* return: NULL error or != NULL new sarr |
* return: NULL error or != NULL new sarr |
*/ |
*/ |
sarr_t * |
sarr_t * |
io_array2sarr(array_t ** __restrict a, int arrFree) | io_array2sarr(array_t ** __restrict a, int segLen, int arrFree) |
{ |
{ |
return NULL; | sarr_t *sa = NULL; |
| int el; |
| register int i; |
| |
| assert(a && *a); |
| if (!a || !*a) |
| return NULL; |
| |
| el = io_arraySize(*a); |
| sa = io_sarrInit(el, segLen); |
| if (!sa) |
| return NULL; |
| |
| for (i = 0; i < el; i++) |
| io_sarrSet(sa, i + 1, io_arrayGet(*a, i)); |
| |
| if (arrFree) { |
| free(*a); |
| *a = NULL; |
| } |
| return sa; |
} |
} |