|
version 1.4.20.2, 2013/08/21 16:08:51
|
version 1.7, 2014/01/29 14:16:54
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 | Copyright 2004 - 2014 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 409 ait_clrVars(array_t * __restrict vars)
|
Line 409 ait_clrVars(array_t * __restrict vars)
|
| void |
void |
| ait_freeVars(array_t ** __restrict vars) |
ait_freeVars(array_t ** __restrict vars) |
| { |
{ |
| |
register int i; |
| |
ait_val_t *v; |
| |
|
| if (!vars || !*vars) |
if (!vars || !*vars) |
| return; |
return; |
| |
|
| ait_clrVars(*vars); | for (i = 0; i < array_Size(*vars); i++) |
| array_Free(*vars); | if ((v = array(*vars, i, ait_val_t*))) { |
| | /* free memory if isn't zero copy */ |
| | if (!AIT_IN(v)) { |
| | AIT_FREE_VAL(v); |
| | if ((*vars)->arr_data[i]) |
| | e_free((*vars)->arr_data[i]); |
| | } else |
| | AIT_FREE_VAL(v); |
| | (*vars)->arr_data[i] = NULL; |
| | } |
| | (*vars)->arr_last = -1; |
| | |
| array_Destroy(vars); |
array_Destroy(vars); |
| } |
} |
| |
|
|
Line 421 ait_freeVars(array_t ** __restrict vars)
|
Line 435 ait_freeVars(array_t ** __restrict vars)
|
| * ait_resideVars() - Calculate footprint of resided variables into array |
* ait_resideVars() - Calculate footprint of resided variables into array |
| * |
* |
| * @vars = Variable array |
* @vars = Variable array |
| * return: -1 error or !=-1 bytes for whole array | * return: bytes for whole array |
| */ |
*/ |
| ssize_t | size_t |
| ait_resideVars(array_t * __restrict vars) |
ait_resideVars(array_t * __restrict vars) |
| { |
{ |
| ssize_t ret = 0; | size_t ret = 0; |
| register int i; |
register int i; |
| |
|
| if (!vars) | if (vars) { |
| return -1; | ret = array_Size(vars) * sizeof(ait_val_t); |
| for (i = 0; i < array_Size(vars); i++) |
| ret = array_Size(vars) * sizeof(ait_val_t); | switch (AIT_TYPE(array(vars, i, ait_val_t*))) { |
| for (i = 0; i < array_Size(vars); i++) | case buffer: |
| switch (AIT_TYPE(array(vars, i, ait_val_t*))) { | case string: |
| case buffer: | case data: |
| case string: | case ptr: |
| case data: | ret += AIT_LEN(array(vars, i, ait_val_t*)); |
| case ptr: | break; |
| ret += AIT_LEN(array(vars, i, ait_val_t*)); | default: |
| break; | break; |
| default: | } |
| break; | } |
| } | |
| |
|
| return ret; |
return ret; |
| } |
} |