version 1.6.2.1, 2012/05/14 16:02:27
|
version 1.7.2.5, 2012/05/18 13:52:52
|
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 489 io_allocVars(int varnum)
|
Line 489 io_allocVars(int varnum)
|
} |
} |
|
|
return arr; |
return arr; |
|
} |
|
|
|
/* |
|
* 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*); |
} |
} |
|
|
/* |
/* |