version 1.12.4.2, 2012/08/29 13:30:28
|
version 1.12.4.3, 2012/08/29 13:49:04
|
Line 655 io_findKeyVars(array_t * __restrict vars, u_short key)
|
Line 655 io_findKeyVars(array_t * __restrict vars, u_short key)
|
} |
} |
|
|
/* |
/* |
* io_hashVar() - Generate hash key for variable | * io_hashVar() - Generate hash key for variable from string or value |
* |
* |
* @v = variable |
* @v = variable |
|
* @key = key string for hash, if =NULL hash will built from variable |
* return: hash key |
* return: hash key |
*/ |
*/ |
u_short |
u_short |
io_hashVar(ait_val_t * __restrict v) | io_hashVar(ait_val_t * __restrict v, const char * __restrict key) |
{ |
{ |
void *p; |
void *p; |
u_short cksum; |
u_short cksum; |
Line 670 io_hashVar(ait_val_t * __restrict v)
|
Line 671 io_hashVar(ait_val_t * __restrict v)
|
if (!v) |
if (!v) |
return 0; |
return 0; |
|
|
switch (AIT_TYPE(v)) { | if (key) { |
case empty: | p = (void*) key; |
AIT_KEY(v) = 0; | l = (strlen(key) + 1) / 2; |
return 0; | } else { |
case string: | switch (AIT_TYPE(v)) { |
case buffer: | case empty: |
p = AIT_ADDR(v); | AIT_KEY(v) = 0; |
l = AIT_LEN(v) / 2; | return 0; |
break; | case string: |
case data: | case buffer: |
p = v->val_data; | p = AIT_ADDR(v); |
l = AIT_LEN(v) / 2; | l = AIT_LEN(v) / 2; |
break; | break; |
default: | case data: |
p = &AIT_RAW(v); | p = v->val_data; |
l = sizeof AIT_RAW(v) / 2; | l = AIT_LEN(v) / 2; |
break; | break; |
| default: |
| p = &AIT_RAW(v); |
| l = sizeof AIT_RAW(v) / 2; |
| break; |
| } |
} |
} |
|
|
cksum = crcFletcher16((u_short*) p, l); |
cksum = crcFletcher16((u_short*) p, l); |
|
|
if (AIT_BE(v)) |
if (AIT_BE(v)) |
Line 715 io_hashKeyVars(array_t * __restrict vars)
|
Line 722 io_hashKeyVars(array_t * __restrict vars)
|
return -1; |
return -1; |
|
|
for (i = 0; i < io_arraySize(vars); i++) |
for (i = 0; i < io_arraySize(vars); i++) |
io_hashVar(io_array(vars, i, ait_val_t*)); | io_hashVar(io_array(vars, i, ait_val_t*), NULL); |
|
|
return 0; |
return 0; |
} |
} |