version 1.2, 2011/10/31 13:53:51
|
version 1.2.2.1, 2011/11/03 14:17:39
|
Line 421 io_map2vals(u_char *buf, int buflen, int vnum, int zcp
|
Line 421 io_map2vals(u_char *buf, int buflen, int vnum, int zcp
|
|
|
return vars; |
return vars; |
} |
} |
|
|
|
|
|
/* |
|
* io_allocVars() Allocate ait_val_t array |
|
* @varnum = Number of variables |
|
* return: =NULL error or !=NULL allocated array |
|
*/ |
|
inline array_t * |
|
io_allocVars(u_int varnum) |
|
{ |
|
array_t *arr; |
|
register int i; |
|
ait_val_t *v; |
|
|
|
if (!varnum || !(arr = io_arrayInit(varnum))) |
|
return NULL; |
|
|
|
for (i = 0; i < io_arraySize(arr); i++) { |
|
v = malloc(sizeof(ait_val_t)); |
|
if (!v) { |
|
LOGERR; |
|
io_freeVars(&arr); |
|
return NULL; |
|
} else { |
|
memset(v, 0, sizeof(ait_val_t)); |
|
io_arraySet(arr, i, v); |
|
} |
|
} |
|
|
|
return arr; |
|
} |
|
|
|
/* |
|
* io_freeVars() Free ait_val_t array |
|
* @vars = Variable array |
|
* return: none |
|
*/ |
|
inline void |
|
io_freeVars(array_t ** __restrict vars) |
|
{ |
|
register int i; |
|
|
|
if (!vars || !*vars) |
|
return; |
|
|
|
for (i = 0; i < io_arraySize(*vars); i++) |
|
if (io_arrayGet(*vars, i)) |
|
AIT_FREE_VAL(io_array(*vars, i, ait_val_t*)); |
|
|
|
io_arrayFree(*vars); |
|
io_arrayDestroy(vars); |
|
} |