version 1.3.2.2, 2011/08/26 12:51:01
|
version 1.3.2.3, 2011/08/26 13:19:35
|
Line 290 io_sarr2array(sarr_t ** __restrict sa, int sarrFree)
|
Line 290 io_sarr2array(sarr_t ** __restrict sa, int sarrFree)
|
/* |
/* |
* 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; |
} |
} |