version 1.5.2.5, 2012/05/14 12:48:21
|
version 1.9, 2012/05/19 00:11:58
|
Line 477 io_allocVars(int varnum)
|
Line 477 io_allocVars(int varnum)
|
register int i; |
register int i; |
ait_val_t *v; |
ait_val_t *v; |
|
|
if (!varnum || !(arr = io_arrayInit(varnum))) | if (!(arr = io_arrayInit(varnum))) |
return NULL; |
return NULL; |
|
|
for (i = 0; i < io_arraySize(arr); i++) { |
for (i = 0; i < io_arraySize(arr); i++) { |
Line 492 io_allocVars(int varnum)
|
Line 492 io_allocVars(int varnum)
|
} |
} |
|
|
/* |
/* |
|
* io_getVars() - Get ait_val_t element from array and if not exists allocate it |
|
* |
|
* @vars = Variable array |
|
* @n = index of variable into array |
|
* return: NULL error or !=NULL ait_val_t element |
|
*/ |
|
inline ait_val_t * |
|
io_getVars(array_t ** __restrict vars, int n) |
|
{ |
|
register int i; |
|
ait_val_t *v; |
|
|
|
if (!vars) |
|
return NULL; |
|
|
|
if (!*vars) { |
|
if (!(*vars = io_allocVars(n + 1))) |
|
return NULL; |
|
} else { |
|
if (n >= (i = io_arraySize(*vars))) { |
|
if (io_arrayGrow(*vars, n + 1, 0)) |
|
return NULL; |
|
for (; i < io_arraySize(*vars); i++) |
|
if (!io_arrayGet(*vars, i)) { |
|
if (!(v = io_allocVar())) |
|
return NULL; |
|
else |
|
io_arraySet(*vars, n, v); |
|
} |
|
} |
|
} |
|
|
|
return io_array(*vars, n, ait_val_t*); |
|
} |
|
|
|
/* |
* io_clrVars() - Clear ait_val_t elements from array |
* io_clrVars() - Clear ait_val_t elements from array |
* |
* |
* @vars = Variable array |
* @vars = Variable array |
Line 501 inline int
|
Line 537 inline int
|
io_clrVars(array_t * __restrict vars) |
io_clrVars(array_t * __restrict vars) |
{ |
{ |
register int i; |
register int i; |
|
ait_val_t *v; |
|
|
if (!vars) |
if (!vars) |
return -1; |
return -1; |
|
|
for (i = 0; i < io_arraySize(vars); i++) |
for (i = 0; i < io_arraySize(vars); i++) |
io_freeVar((ait_val_t**) io_arrayGet2(vars, i)); | if ((v = io_array(vars, i, ait_val_t*))) |
| AIT_FREE_VAL(v); |
|
|
return io_arraySize(vars); |
return io_arraySize(vars); |
} |
} |
Line 524 io_freeVars(array_t ** __restrict vars)
|
Line 562 io_freeVars(array_t ** __restrict vars)
|
return; |
return; |
|
|
io_clrVars(*vars); |
io_clrVars(*vars); |
|
io_arrayFree(*vars); |
io_arrayDestroy(vars); |
io_arrayDestroy(vars); |
} |
} |
|
|