avoid explicit casts if possible (small refacotring on dict.c, system.c)
This commit is contained in:
parent
7f68fd3e2a
commit
d165b6ea6f
10
dict.c
10
dict.c
|
@ -12,11 +12,13 @@ xh_value_hash(const void *key, void *data)
|
|||
{
|
||||
union { double f; int i; } u;
|
||||
pic_value val = *(pic_value *)key;
|
||||
int hash;
|
||||
int hash, vtype;
|
||||
|
||||
UNUSED(data);
|
||||
|
||||
switch (pic_vtype(val)) {
|
||||
vtype = pic_vtype(val);
|
||||
|
||||
switch (vtype) {
|
||||
default:
|
||||
hash = 0;
|
||||
break;
|
||||
|
@ -31,11 +33,11 @@ xh_value_hash(const void *key, void *data)
|
|||
hash = pic_int(val);
|
||||
break;
|
||||
case PIC_VTYPE_HEAP:
|
||||
hash = (int)pic_ptr(val);
|
||||
hash = (int)(intptr_t)pic_ptr(val);
|
||||
break;
|
||||
}
|
||||
|
||||
return hash + (int)pic_vtype(val);
|
||||
return hash + vtype;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
4
system.c
4
system.c
|
@ -105,12 +105,12 @@ pic_system_getenvs(pic_state *pic)
|
|||
|
||||
for (envp = pic->envp; *envp; ++envp) {
|
||||
pic_str *key, *val;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; (*envp)[i] != '='; ++i)
|
||||
;
|
||||
|
||||
key = pic_make_str(pic, *envp, (size_t)i);
|
||||
key = pic_make_str(pic, *envp, i);
|
||||
val = pic_make_str_cstr(pic, getenv(pic_str_cstr(key)));
|
||||
|
||||
/* push */
|
||||
|
|
Loading…
Reference in New Issue