|
|
| version 1.3.2.3, 2011/08/26 13:19:35 | version 1.4.2.3, 2011/08/31 13:19:22 |
|---|---|
| Line 90 io_sarrDestroy(sarr_t ** __restrict parr) | Line 90 io_sarrDestroy(sarr_t ** __restrict parr) |
| { | { |
| register int i; | register int i; |
| assert(parr && *parr); | |
| if (!parr || !*parr) | if (!parr || !*parr) |
| return; | return; |
| Line 107 io_sarrDestroy(sarr_t ** __restrict parr) | Line 106 io_sarrDestroy(sarr_t ** __restrict parr) |
| } | } |
| /* | /* |
| * 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) | |
| { | |
| assert(dest); | |
| assert(src); | |
| if (!dest || !src) | |
| return -1; | |
| *dest = io_sarrInit(io_sarrSize(src), io_sarrSeg(src)); | |
| if (!*dest) | |
| return -1; | |
| memcpy((*dest)->sarr_data, src->sarr_data, (*dest)->sarr_siz * sizeof(sarr_seg_t)); | |
| return io_sarrSize(*dest); | |
| } | |
| /* | |
| * io_sarrVacuum() - Vacuum dynamic split-order array, empty segments will be freed | * io_sarrVacuum() - Vacuum dynamic split-order array, empty segments will be freed |
| * @arr = Array | * @arr = Array |
| * return: -1 error, >-1 freed segments | * return: -1 error, >-1 freed segments |
| Line 118 io_sarrVacuum(sarr_t * __restrict arr) | Line 139 io_sarrVacuum(sarr_t * __restrict arr) |
| int cx = 0; | int cx = 0; |
| sarr_seg_t seg; | sarr_seg_t seg; |
| assert(arr); | |
| if (!arr) | if (!arr) |
| return -1; | return -1; |
| Line 150 io_sarrGrow(sarr_t * __restrict arr, int newNumItems) | Line 170 io_sarrGrow(sarr_t * __restrict arr, int newNumItems) |
| int seg, n = 0; | int seg, n = 0; |
| register int i; | register int i; |
| assert(arr); | |
| if (!arr) | if (!arr) |
| return -1; | return -1; |
| Line 189 io_sarrGet(sarr_t * __restrict arr, u_int idx) | Line 208 io_sarrGet(sarr_t * __restrict arr, u_int idx) |
| void *ret = NULL; | void *ret = NULL; |
| sarr_seg_t seg; | sarr_seg_t seg; |
| assert(arr); | |
| if (!arr || idx < 1 || arr->sarr_num < idx) | if (!arr || idx < 1 || arr->sarr_num < idx) |
| return ret; | return ret; |
| Line 210 io_sarrGet(sarr_t * __restrict arr, u_int idx) | Line 228 io_sarrGet(sarr_t * __restrict arr, u_int idx) |
| void * | void * |
| io_sarrGet2(sarr_t * __restrict arr, u_int idx) | io_sarrGet2(sarr_t * __restrict arr, u_int idx) |
| { | { |
| assert(arr); | |
| if (!arr || idx < 1) | if (!arr || idx < 1) |
| return NULL; | return NULL; |
| if (arr->sarr_num < idx) | if (arr->sarr_num < idx) |
| Line 233 io_sarrSet(sarr_t * __restrict arr, u_int idx, void *d | Line 250 io_sarrSet(sarr_t * __restrict arr, u_int idx, void *d |
| sarr_seg_t seg; | sarr_seg_t seg; |
| register int pos; | register int pos; |
| assert(arr); | |
| if (!arr || idx < 1 || arr->sarr_num < idx) | if (!arr || idx < 1 || arr->sarr_num < idx) |
| return ret; | return ret; |