|
version 1.3.2.1, 2013/05/26 20:03:19
|
version 1.8, 2015/06/25 17:53:50
|
|
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 - 2015 |
| 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 123 vars2buffer(u_char * __restrict buf, int buflen, int b
|
Line 123 vars2buffer(u_char * __restrict buf, int buflen, int b
|
| break; |
break; |
| case buffer: |
case buffer: |
| case string: |
case string: |
| |
case ptr: |
| if (AIT_LEN(val) > buflen - Limit) { |
if (AIT_LEN(val) > buflen - Limit) { |
| elwix_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
elwix_SetErr(EMSGSIZE, "Short buffer buflen=%d " |
| "needed min %d", buflen, Limit + AIT_LEN(val)); |
"needed min %d", buflen, Limit + AIT_LEN(val)); |
|
Line 218 buffer2vars(u_char * __restrict buf, int buflen, int v
|
Line 219 buffer2vars(u_char * __restrict buf, int buflen, int v
|
| val->val.net = le64toh(v[i].val.net); |
val->val.net = le64toh(v[i].val.net); |
| break; |
break; |
| case data: |
case data: |
| /* WARNING:: remap data type to buffer */ | case ptr: |
| | /* WARNING:: remap data and ptr type to buffer! */ |
| val->val_type = buffer; |
val->val_type = buffer; |
| case buffer: |
case buffer: |
| case string: |
case string: |
|
Line 407 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); |
| |
} |
| |
|
| |
/* |
| |
* ait_resideVars() - Calculate footprint of resided variables into array |
| |
* |
| |
* @vars = Variable array |
| |
* return: bytes for whole array |
| |
*/ |
| |
size_t |
| |
ait_resideVars(array_t * __restrict vars) |
| |
{ |
| |
size_t ret = 0; |
| |
register int i; |
| |
|
| |
if (vars) { |
| |
ret = array_Size(vars) * sizeof(ait_val_t); |
| |
for (i = 0; i < array_Size(vars); i++) |
| |
switch (AIT_TYPE(array(vars, i, ait_val_t*))) { |
| |
case buffer: |
| |
case string: |
| |
case data: |
| |
case ptr: |
| |
ret += AIT_LEN(array(vars, i, ait_val_t*)); |
| |
break; |
| |
default: |
| |
break; |
| |
} |
| |
} |
| |
|
| |
return ret; |
| } |
} |
| |
|
| |
|