version 1.4.2.3, 2011/08/31 13:19:22
|
version 1.6, 2011/12/13 02:23:08
|
Line 294 io_arrayVacuum(array_t * __restrict arr, int fromWhere
|
Line 294 io_arrayVacuum(array_t * __restrict arr, int fromWhere
|
} |
} |
|
|
/* |
/* |
|
* io_arrayElem() - Always GET/PUT element into dynamic array, if not enough elements grow array |
|
* @arr = Array |
|
* @n = Position |
|
* @data = Element, if set NULL GET element at position or !=NULL PUT element at position |
|
* return: -1 error or !=-1 return element at position |
|
*/ |
|
inline void * |
|
io_arrayElem(array_t * __restrict arr, int n, void **data) |
|
{ |
|
void *dat = NULL; |
|
|
|
if (!arr) |
|
return (void*) -1; |
|
|
|
if (n > io_arraySize(arr) && io_arrayGrow(arr, n + 1, 0)) |
|
return (void*) -1; |
|
|
|
dat = io_arrayGet(arr, n); |
|
if (data) |
|
io_arraySet(arr, n, *data); |
|
|
|
return dat; |
|
} |
|
|
|
/* |
* io_arrayPush() - Push element into dynamic array like stack manner, place at first empty position |
* io_arrayPush() - Push element into dynamic array like stack manner, place at first empty position |
* @arr = Array |
* @arr = Array |
* @data = Element, if set NULL return only first empty position |
* @data = Element, if set NULL return only first empty position |
Line 305 io_arrayPush(array_t * __restrict arr, void **data)
|
Line 330 io_arrayPush(array_t * __restrict arr, void **data)
|
register int i; |
register int i; |
int ret = -1; |
int ret = -1; |
|
|
|
if (!arr) |
|
return -1; |
|
|
for (i = 0; i < io_arraySize(arr); i++) |
for (i = 0; i < io_arraySize(arr); i++) |
if (!arr->arr_data[i]) { |
if (!arr->arr_data[i]) { |
if (data) |
if (data) |
Line 328 io_arrayPop(array_t * __restrict arr, void ** __restri
|
Line 356 io_arrayPop(array_t * __restrict arr, void ** __restri
|
{ |
{ |
register int i; |
register int i; |
int ret = -1; |
int ret = -1; |
|
|
|
if (!arr) |
|
return -1; |
|
|
for (i = io_arraySize(arr) - 1; i >= 0; i--) |
for (i = io_arraySize(arr) - 1; i >= 0; i--) |
if (arr->arr_data[i]) { |
if (arr->arr_data[i]) { |